(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~.
This commit is contained in:
@@ -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~
|
||||
|
||||
Reference in New Issue
Block a user