docs: add examples.org

This adds the basic framework of docs/examples.org, including the former
contents of demo.org in :lang emacs-lisp. elisp-demo has also been
reconfigured to search it instead.

Keep in mind that examples.org references a few things in as-of-yet
published documentation. This will be rectified soon.
This commit is contained in:
Henrik Lissner 2022-09-12 17:11:16 +02:00
parent e71daf5cc3
commit 94ea4aa7dc
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 553 additions and 266 deletions

View file

@ -196,24 +196,7 @@ 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
(defadvice! +emacs-lisp--add-doom-elisp-demos-a (fn symbol)
"Add Doom's own demos to help buffers."
:around #'elisp-demos--search
(or (funcall fn symbol)
(when-let (demos-file (doom-module-locate-path :lang 'emacs-lisp "demos.org"))
(with-temp-buffer
(insert-file-contents demos-file)
(goto-char (point-min))
(when (re-search-forward
(format "^\\*\\* %s$" (regexp-quote (symbol-name symbol)))
nil t)
(let (beg end)
(forward-line 1)
(setq beg (point))
(if (re-search-forward "^\\*" nil t)
(setq end (line-beginning-position))
(setq end (point-max)))
(string-trim (buffer-substring-no-properties beg end)))))))))
(advice-add #'elisp-demos--search :around #'+emacs-lisp--add-doom-elisp-demos-a))
(use-package! buttercup