Minor updates.

This commit is contained in:
Derek Taylor
2020-08-11 17:27:59 -05:00
parent c00618a23a
commit 367af05623
154 changed files with 2484 additions and 1801 deletions

View File

@@ -251,13 +251,17 @@ or aliases."
(declare (doc-string 1) (pure t) (side-effect-free t))
`(lambda (&rest _) (interactive) ,@body))
(defmacro cmd!! (command &rest args)
(defmacro cmd!! (command &optional prefix-arg &rest args)
"Expands to a closure that interactively calls COMMAND with ARGS.
A factory for quickly producing interactive, prefixed commands for keybinds or
aliases."
(declare (doc-string 1) (pure t) (side-effect-free t))
`(lambda (&rest _) (interactive)
(funcall-interactively ,command ,@args)))
`(lambda (arg &rest _) (interactive "P")
(let ((current-prefix-arg (or ,prefix-arg arg)))
(,(if args
'funcall-interactively
'call-interactively)
,command ,@args))))
(defmacro cmds! (&rest branches)
"Expands to a `menu-item' dispatcher for keybinds."
@@ -324,7 +328,7 @@ The current file is the file from which `add-to-load-path!' is used."
`(let ((default-directory ,(dir!))
file-name-handler-alist)
(dolist (dir (list ,@dirs))
(cl-pushnew (expand-file-name dir) load-path))))
(cl-pushnew (expand-file-name dir) load-path :test #'string=))))
(defmacro after! (package &rest body)
"Evaluate BODY after PACKAGE have loaded.
@@ -486,7 +490,10 @@ advised)."
(defmacro add-hook-trigger! (hook-var &rest targets)
"TODO"
`(let ((fn (intern (format "%s-h" ,hook-var))))
(fset fn (lambda (&rest _) (run-hooks ,hook-var) (set ,hook-var nil)))
(fset
fn (lambda (&rest _)
(run-hook-wrapped ,hook-var #'doom-try-run-hook)
(set ,hook-var nil)))
(put ,hook-var 'permanent-local t)
(dolist (on (list ,@targets))
(if (functionp on)
@@ -632,7 +639,7 @@ testing advice (when combined with `rotate-text').
;;
;;; Backports
(when! (not EMACS27+)
(when! (version< emacs-version "27.0.90")
;; DEPRECATED Backported from Emacs 27
(defmacro setq-local (&rest pairs)
"Make variables in PAIRS buffer-local and assign them the corresponding values.