refactor(emacs-lisp): elisp-demos: reorganize Doom demos
- Move Doom core elisp API demos out of docs/examples.org into lisp/demos.org. - Recognize and search demos.org file in modules for additional demos (including $DOOMDIR/demos.org). - Refactor emacs-lisp module to use new elisp-demos-user-files variable instead of an advice. This way, elisp-demo's commands (such as `elisp-demos-find-demo` and `elisp-demos-add-demo`) will include Doom's demos.
This commit is contained in:
parent
77ea4013dd
commit
3bea4f66a8
4 changed files with 675 additions and 703 deletions
|
@ -217,7 +217,26 @@ See `+emacs-lisp-non-package-mode' for details.")
|
|||
(advice-add #'describe-function-1 :after #'elisp-demos-advice-describe-function-1)
|
||||
(advice-add #'helpful-update :after #'elisp-demos-advice-helpful-update)
|
||||
:config
|
||||
(advice-add #'elisp-demos--search :around #'+emacs-lisp--add-doom-elisp-demos-a))
|
||||
;; Add Doom's core and module demo files, so additional demos can be specified
|
||||
;; by end-users (in $DOOMDIR/demos.org), by modules (modules/X/Y/demos.org),
|
||||
;; or Doom's core (lisp/demos.org).
|
||||
(dolist (file (doom-module-locate-paths (doom-module-list) "demos.org"))
|
||||
(add-to-list 'elisp-demos-user-files file))
|
||||
|
||||
;; HACK: These functions open Org files non-interactively without any
|
||||
;; performance optimizations. Given how prone org-mode is to being tied to
|
||||
;; expensive functionality, this will often introduce unexpected freezes
|
||||
;; without this advice.
|
||||
;; TODO: PR upstream?
|
||||
(defadvice! +emacs-lisp--optimize-org-init-a (fn &rest args)
|
||||
"Disable unrelated functionality to optimize calls to `org-mode'."
|
||||
:around #'elisp-demos--export-json-file
|
||||
:around #'elisp-demos--symbols
|
||||
:around #'elisp-demos--syntax-highlight
|
||||
(let ((org-inhibit-startup t)
|
||||
enable-dir-local-variables
|
||||
org-mode-hook)
|
||||
(apply fn args))))
|
||||
|
||||
|
||||
(use-package! buttercup
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue