home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit 702763045eec8faeefcc4caa91c71b15965e2bc6
parent e28274f7df3414f5c6b8c68528d91f05890baf9f
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Wed, 28 Sep 2022 17:00:52 +0200

tools/emacs: some elfeed and refactoring

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mtools/emacs/config/config-elfeed.el | 44+++++++++++++++++++++++++++++++++++++++++++-
Mtools/emacs/config/config-windows.el | 2++
Mtools/emacs/init.el | 16++--------------
Mtools/emacs/lisp/init-func.el | 11+++++++++++
4 files changed, 58 insertions(+), 15 deletions(-)

diff --git a/tools/emacs/config/config-elfeed.el b/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 diff --git a/tools/emacs/config/config-windows.el b/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 diff --git a/tools/emacs/init.el b/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"))) diff --git a/tools/emacs/lisp/init-func.el b/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.