From 0b43dc0094ad2b8adfa63a4d5ec868ff7bd66d9a Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 9 Jan 2022 06:08:51 +0000 Subject: (Emacs)+environment setup macro This basically makes it easier to provide unique configurations across my devices without screwing up the vc. --- Emacs/.config/emacs/config.org | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Emacs/.config/emacs') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 27c77e8..cf1482d 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -111,7 +111,7 @@ the buffer with name buf-name and creation function buf-create." (display-buffer buffer) (select-window (get-buffer-window buffer))))))) #+end_src -** Auto-run command after-save-hook +** Create auto save Macro that defines functionality that runs after a buffer save. 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. @@ -140,7 +140,7 @@ errors and general messages. Better than vim, eh? ,@to-run)) (add-hook 'after-save-hook (quote ,func-name))))) #+end_src -** Define procedure +** Procedure The =lambda= macro provides a function with possible arguments. A procedure is a type of form that takes no arguments. This macro 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." `(quote (lambda () ,@CDR))) #+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 Load my custom "personal-theme" theme which is stored in the Emacs lisp folder (look at [[file:elisp/personal-theme.el][this file]]). -- cgit v1.2.3-13-gbd6f