(Emacs)+environment setup macro

This basically makes it easier to provide unique configurations across
my devices without screwing up the vc.
This commit is contained in:
2022-01-09 06:08:51 +00:00
parent 78232a1055
commit 0b43dc0094

View File

@@ -111,7 +111,7 @@ the buffer with name buf-name and creation function buf-create."
(display-buffer buffer) (display-buffer buffer)
(select-window (get-buffer-window buffer))))))) (select-window (get-buffer-window buffer)))))))
#+end_src #+end_src
** Auto-run command after-save-hook ** Create auto save
Macro that defines functionality that runs after a buffer save. Macro that defines functionality that runs after a buffer save.
Requires a list of conditions (so it doesn't happen FOR ALL saved Requires a list of conditions (so it doesn't happen FOR ALL saved
buffers) and a function to run if the buffer satisfies the condition. buffers) and a function to run if the buffer satisfies the condition.
@@ -140,7 +140,7 @@ errors and general messages. Better than vim, eh?
,@to-run)) ,@to-run))
(add-hook 'after-save-hook (quote ,func-name))))) (add-hook 'after-save-hook (quote ,func-name)))))
#+end_src #+end_src
** Define procedure ** Procedure
The =lambda= macro provides a function with possible arguments. A The =lambda= macro provides a function with possible arguments. A
procedure is a type of form that takes no arguments. This macro procedure is a type of form that takes no arguments. This macro
returns an anonymous function with no arguments with all the forms returns an anonymous function with no arguments with all the forms
@@ -151,6 +151,14 @@ common use of this macro.
"For a given list of forms CDR, return a quoted non-argument lambda." "For a given list of forms CDR, return a quoted non-argument lambda."
`(quote (lambda () ,@CDR))) `(quote (lambda () ,@CDR)))
#+end_src #+end_src
** Environment setup
Provides a macro to do quick environmental conditionals.
#+begin_src emacs-lisp
(defconst +dx:environment (system-name))
(defmacro +dx/env-cond (name &rest to-run)
`(when (string= +dx:environment ,name)
,@to-run))
#+end_src
* Aesthetics * Aesthetics
Load my custom "personal-theme" theme which is stored in the Emacs lisp Load my custom "personal-theme" theme which is stored in the Emacs lisp
folder (look at [[file:elisp/personal-theme.el][this file]]). folder (look at [[file:elisp/personal-theme.el][this file]]).