Last active
July 17, 2019 13:52
-
-
Save danhodge/7ce8a2a25be5bfce44dc9f164dd19e6e to your computer and use it in GitHub Desktop.
Emacs LISP Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Use this to drop into a debugger when a error occurs: M-x toggle-debug-on-error | |
; Trying to figure out how namespaced elisp functions work: https://www.greghendershott.com/2017/02/emacs-themes.html | |
(defun dh/foo (x) | |
"adds 4 to x" | |
(+ x 4)) | |
(dh/foo 1) | |
(defun dh/bar (x, fn) | |
"adds 5 to fn(x)" | |
(+ 5 (fn x))) | |
(dh/bar 7 #'dh/foo) | |
; passing a function as an argument & evaluating it | |
(defun plus1 (x) (+ 1 x)) | |
(defun callfn (fn x) (funcall fn x)) | |
(callfn 'plus1 2) | |
; define & save a custom keyboard macro | |
; 1. define the macro ;; C-x ( ... C-x ) | |
; 2. M-x name-last-kbd-macro ;; give it a name | |
; 3. M-x insert-kbd-macro ;; dumps the macro definition to your current cursor location | |
; 4. copy the macro definition into init.el for posterity | |
; evaluate any elisp function (not just interactive functions) | |
; M-: <function> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment