summaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-10-21 03:12:36 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-10-21 03:12:36 +0200
commit52a4f5ab818402f53bf152830151fccb62cc359d (patch)
treee8f4faf4055833591ebb4f058f15f7b1de7b1613 /.emacs.d
parent4db31ed091269abba3c2d5ce85efbef4ededc46f (diff)
downloadebsd-52a4f5ab818402f53bf152830151fccb62cc359d.tar.gz
Emacs: Add set-keys-and-load macro
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/init.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 6ce29bf..82d9bcb 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -15,6 +15,18 @@
into exps
finally return `(progn ,@exps)))
+(defmacro set-keys-and-load (file &rest keys)
+ "Call `autoload' and `global-set-key' at once."
+ (declare (indent defun))
+ (cl-loop for (key fun) on keys by #'cddr
+ collect `(progn
+ (autoload #',fun ,(if (stringp file) file (symbol-name file)) nil t)
+ (global-set-key
+ ,(if (stringp key) `(kbd ,key) key)
+ ,(if (listp fun) fun `#',fun)))
+ into exps
+ finally return `(progn ,@exps)))
+
(defmacro set-keys-in (maps &rest keys)
"Set multiple keys in multiple keymaps."
(declare (indent defun))
@@ -72,14 +84,13 @@
"Run `async-shell-command', then delete the current window."
(interactive)
(call-interactively #'async-shell-command)
- (delete-window)) ; TODO: Function for opening X program with
- ; associated command output buffer.
+ (delete-window))
(defun customize-setq ()
"Customize variable according to `setq' expression at point."
(interactive)
(let ((sexp (list-at-point)))
- (unless (symbol-value))))
+ (unless (symbol-value)))) ; TODO
(defun kill-buffer-now ()
"Kill the current buffer immediately."