Minor refactor of core-dispatcher
This commit is contained in:
parent
2e92f8d8a8
commit
3b528302b2
1 changed files with 18 additions and 17 deletions
|
@ -40,8 +40,8 @@ omitted, show all available commands, their aliases and brief descriptions."
|
||||||
(if command
|
(if command
|
||||||
(princ (doom--dispatch-format desc))
|
(princ (doom--dispatch-format desc))
|
||||||
(print! (bold "%-10s\t%s\t%s" "Command:" "Alias" "Description"))
|
(print! (bold "%-10s\t%s\t%s" "Command:" "Alias" "Description"))
|
||||||
(dolist (spec (sort doom--dispatch-command-alist
|
(dolist (spec (cl-sort doom--dispatch-command-alist #'string-lessp
|
||||||
(lambda (x y) (string-lessp (car x) (car y)))))
|
:key #'car))
|
||||||
(cl-destructuring-bind (command &key desc _body) spec
|
(cl-destructuring-bind (command &key desc _body) spec
|
||||||
(let ((aliases (cl-loop for (alias . cmd) in doom--dispatch-alias-alist
|
(let ((aliases (cl-loop for (alias . cmd) in doom--dispatch-alias-alist
|
||||||
if (eq cmd command)
|
if (eq cmd command)
|
||||||
|
@ -71,17 +71,15 @@ bin/doom help.
|
||||||
|
|
||||||
BODY will be run when this dispatcher is called."
|
BODY will be run when this dispatcher is called."
|
||||||
(declare (doc-string 3))
|
(declare (doc-string 3))
|
||||||
(let* ((command (doom-enlist command))
|
(cl-destructuring-bind (cmd &rest aliases) (doom-enlist command)
|
||||||
(cmd (car command))
|
(macroexp-progn
|
||||||
(aliases (cdr command)))
|
(append
|
||||||
`(progn
|
(when aliases
|
||||||
,(when aliases
|
`((dolist (alias ',aliases)
|
||||||
`(dolist (alias ',aliases)
|
(map-put doom--dispatch-alias-alist alias ',cmd))))
|
||||||
(map-put doom--dispatch-alias-alist alias ',cmd)))
|
`((map-put doom--dispatch-command-alist ',cmd
|
||||||
(map-put doom--dispatch-command-alist
|
(list :desc ,docstring
|
||||||
',cmd (list :desc ,docstring
|
:body (lambda (args) ,form))))))))
|
||||||
;; FIXME Implicit args var; ew
|
|
||||||
:body (lambda (args) ,form))))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -214,8 +212,11 @@ recompiling any changed compiled files. This is the shotgun solution to most
|
||||||
problems with doom."
|
problems with doom."
|
||||||
(doom-reload-doom-autoloads force-p)
|
(doom-reload-doom-autoloads force-p)
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(progn (ignore-errors (doom-packages-autoremove doom-auto-accept))
|
(progn
|
||||||
(ignore-errors (doom-packages-install doom-auto-accept)))
|
(ignore-errors
|
||||||
|
(doom-packages-autoremove doom-auto-accept))
|
||||||
|
(ignore-errors
|
||||||
|
(doom-packages-install doom-auto-accept)))
|
||||||
(doom-reload-package-autoloads force-p)
|
(doom-reload-package-autoloads force-p)
|
||||||
(doom-byte-compile nil 'recompile)))
|
(doom-byte-compile nil 'recompile)))
|
||||||
|
|
||||||
|
@ -361,9 +362,9 @@ even if it doesn't need reloading!"
|
||||||
(or (null file)
|
(or (null file)
|
||||||
(stringp file)
|
(stringp file)
|
||||||
(signal 'wrong-type-argument (list 'stringp file)))
|
(signal 'wrong-type-argument (list 'stringp file)))
|
||||||
(cond ((equal file doom-autoload-file)
|
(cond ((file-equal-p file doom-autoload-file)
|
||||||
(doom-reload-doom-autoloads force-p))
|
(doom-reload-doom-autoloads force-p))
|
||||||
((equal file doom-package-autoload-file)
|
((file-equal-p file doom-package-autoload-file)
|
||||||
(doom-reload-package-autoloads force-p))
|
(doom-reload-package-autoloads force-p))
|
||||||
((progn
|
((progn
|
||||||
(doom-reload-doom-autoloads force-p)
|
(doom-reload-doom-autoloads force-p)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue