(Emacs)~clean up some custom functions

This commit is contained in:
2023-07-13 16:07:14 +01:00
parent 0d0f292d28
commit 9618468828

View File

@@ -71,9 +71,13 @@ any buffer of choice, as long as I can generate it via a command.
buf-create buf-create
&optional accept-numeric) &optional accept-numeric)
"Generate a function named FUNC-NAME that toggles the buffer with "Generate a function named FUNC-NAME that toggles the buffer with
name BUF-NAME, using BUF-CREATE to generate it if necessary. name BUF-NAME, using BUF-CREATE to generate it if buffer BUF-NAME
does not exist already.
BUF-NAME cannot be a regexp, it must be a fixed name." BUF-NAME cannot be a regexp, it must be a fixed name.
ACCEPT-NUMERIC modifies the function to allow numeric arguments
via C-u. Mostly used in Eshell."
(let ((interactive-arg (let ((interactive-arg
(if accept-numeric '(interactive "p") '(interactive))) (if accept-numeric '(interactive "p") '(interactive)))
(arguments (arguments
@@ -121,10 +125,10 @@ common use of this macro.
(You may notice ~proc~ is used where the return value doesn't matter). (You may notice ~proc~ is used where the return value doesn't matter).
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defmacro proc (&rest CDR) (defmacro proc (&rest BODY)
"For a given list of forms CDR, return a quoted non-argument "For a given list of forms BODY, return a quoted 0 argument
lambda." lambda."
`(quote (lambda () ,@CDR))) `(quote (lambda nil ,@BODY)))
#+end_src #+end_src
** System specificity ** System specificity
A macro that acts as a switch case on ~(system-name)~ which allows the A macro that acts as a switch case on ~(system-name)~ which allows the