Commit 702763045eec

Vincent Demeester <vincent@sbr.pm>
2022-09-28 17:00:52
tools/emacs: some elfeed and refactoring
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent e28274f
tools/emacs/config/config-elfeed.el
@@ -5,12 +5,54 @@
 
 (use-package elfeed
   :commands (elfeed)
-  :bind (("C-c x e" . elfeed))
+  :bind (("C-c x e" . elfeed)
+         :map elfeed-show-mode-map
+         ("q" . 'vde/elfeed-show-quit-window))
+  :init
+  ;; (bind-keys
+  ;;  :map elfeed-show-mode-map
+  ;;  ([remap elfeed-search-quit-window] 'vde/elfeed-show-quit-window))
   :config
   (setq-default elfeed-log-level 'debug
                 elfeed-use-curl 't
                 elfeed-db-directory "~/sync/elfeed/db/"
                 elfeed-db-index "~/sync/elfeed/index")
+
+  (setq elfeed-show-entry-switch #'pop-to-buffer
+        elfeed-show-entry-delete #'delete-window
+        elfeed-show-unique-buffers t)
+
+  (defun vde/elfeed-show-quit-window ()
+    (interactive)
+    (if (window-live-p (get-buffer-window "*elfeed-search*"))
+        (progn
+          (kill-buffer-and-window)      ;Don't use quit-window for this
+          (select-window (get-buffer-window "*elfeed-search*")))
+      (kill-buffer (current-buffer))))
+  ;; TODO define what we want for this..
+  ;; TODO also probably handle "quit", on "next", โ€ฆ (if tab)
+  ;; (add-to-list 'display-buffer-alist
+  ;;              '("^\\*elfeed-entry-"
+  ;;                (display-buffer-below-selected)
+  ;;                (direction . bottom)
+  ;;                (window-height . 0.70)))
+  
+  ;; (add-to-list 'display-buffer-alist
+  ;;              `("^\\*elfeed-entry-"
+  ;;                (display-buffer-in-tab)
+  ;;                (dedicated . t)
+  ;;                (tab-name . (lambda (buffer alist)
+  ;;                              (with-current-buffer buffer
+  ;;                                (concat "๐Ÿš€ " (elfeed-feed-title (elfeed-entry-feed elfeed-show-entry))))))
+  ;;                (tab-group . "๐Ÿ“ป Elfeed")))
+  ;; 
+  ;; (add-to-list 'display-buffer-alist
+  ;;              `("\\*elfeed-search\\*"
+  ;;                (display-buffer-in-tab)
+  ;;                (dedicated . t)
+  ;;                (tab-name . "๐Ÿ“ฃ Entries")
+  ;;                (tab-group . "๐Ÿ“ป Elfeed")))
+
   (elfeed-org)
   (defun vde/org-elfeed-entry-store-link ()
     (when elfeed-show-entry
tools/emacs/config/config-windows.el
@@ -3,6 +3,8 @@
 ;;; Windows configuration
 ;; Code:
 
+(setq switch-to-buffer-obey-display-actions t)
+
 ;; Winner
 (use-package winner
   :unless noninteractive
tools/emacs/lisp/init-func.el
@@ -1,6 +1,17 @@
 ;;; init-func.el --- -*- lexical-binding: t -*-
 ;;
 
+(defun vde/el-load-dir (dir)
+  "Load el files from the given folder `DIR'."
+  (let ((files (directory-files dir nil "\.el$")))
+    (while files
+      (load-file (concat dir (pop files))))))
+
+(defun vde/short-hostname ()
+  "Return hostname in short (aka wakasu.local -> wakasu)."
+  (string-match "[0-9A-Za-z-]+" system-name)
+  (substring system-name (match-beginning 0) (match-end 0)))
+
 ;; https://endlessparentheses.com/updating-org-mode-include-statements-on-the-fly.html
 (defun save-and-update-includes ()
   "Update the line numbers of #+INCLUDE:s in current buffer.
tools/emacs/init.el
@@ -102,17 +102,7 @@
          (string-match-p "org$" x))
        load-path))
 
-(defun vde/el-load-dir (dir)
-  "Load el files from the given folder `DIR'."
-  (let ((files (directory-files dir nil "\.el$")))
-    (while files
-      (load-file (concat dir (pop files))))))
-
-(defun vde/short-hostname ()
-  "Return hostname in short (aka wakasu.local -> wakasu)."
-  (string-match "[0-9A-Za-z-]+" system-name)
-  (substring system-name (match-beginning 0) (match-end 0)))
-
+(require 'init-func)
 
 (defconst *sys/gui*
   (display-graphic-p)
@@ -146,9 +136,7 @@
   (not *sys/full*)
   "Is it a light system ?")
 
-(add-to-list 'load-path (concat user-emacs-directory "lisp/"))
-(add-to-list 'load-path (concat user-emacs-directory "lisp/vorg"))
-(require 'init-func)
+(add-to-list 'load-path (concat user-emacs-directory "/lisp/"))
 (vde/el-load-dir (concat user-emacs-directory "/config/"))
 
 (if (file-exists-p (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el")))