aboutsummaryrefslogtreecommitdiff
path: root/Emacs/.config/emacs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-07-11 21:33:53 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-07-11 21:33:53 +0100
commit46f38953c9c85b33bb0ff762271c1fa052daef14 (patch)
treed11db42dde77772f5eb0b9fbaa4258462fbf58b4 /Emacs/.config/emacs
parentd9712a799f9fa6b55aa73895212c13cc4853d241 (diff)
downloaddotfiles-46f38953c9c85b33bb0ff762271c1fa052daef14.tar.gz
dotfiles-46f38953c9c85b33bb0ff762271c1fa052daef14.tar.bz2
dotfiles-46f38953c9c85b33bb0ff762271c1fa052daef14.zip
(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~.
Diffstat (limited to 'Emacs/.config/emacs')
-rw-r--r--Emacs/.config/emacs/config.org27
1 files changed, 13 insertions, 14 deletions
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~