From 46f38953c9c85b33bb0ff762271c1fa052daef14 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 11 Jul 2023 21:33:53 +0100 Subject: (Emacs)~made :display use-package manager more idiomatic When I originally programmed this function I was essentially acting as a code-monkey i.e. "JUST WORK PLEASE". Looking at the code now I see there's a simple function to do essentially the same task, converting from the iterative format I was using to the cleaner and more functional ~mapcar~. --- Emacs/.config/emacs/config.org | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'Emacs/.config/emacs') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 4e9aaa5..ea07e0e 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -939,12 +939,14 @@ pseudo language. ("lambda" . "λ") #+end_example ** Window management -Emacs' default window management is quite bad, eating other windows -and not particularly caring for the current window setup. Thankfully -you can change this via the ~display-buffer-alist~ which matches -buffer names with how the window for the buffer should be displayed. -I add a use-package keyword to make ~display-buffer-alist~ records -within use-package. +Emacs' default window management is quite bad, eating other windows on +a whim and not particularly caring for the current window setup. +Thankfully you can change this via the ~display-buffer-alist~ which +matches buffer names with how the window for the buffer should be +displayed. I add a use-package keyword to make ~display-buffer-alist~ +records within use-package. + +I have no idea whether it's optimal AT ALL, but it works for me. #+begin_src emacs-lisp (use-package window :straight nil @@ -965,14 +967,11 @@ within use-package. (defun use-package-handler/:display (name _keyword args rest state) (use-package-concat (use-package-process-keywords name rest state) - (let ((arg args) - forms) - (while arg - (add-to-list 'forms - `(add-to-list 'display-buffer-alist - ',(car arg))) - (setq arg (cdr arg))) - forms))))) + (mapcar + #'(lambda (arg) + `(add-to-list 'display-buffer-alist + ',arg)) + args))))) #+end_src *** Some display records Using the ~:display~ keyword, setup up some ~display-buffer-alist~ -- cgit v1.2.3-13-gbd6f