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

@ -369,6 +369,31 @@ library/userland functions"
;;
;;; Advice
;;;###autoload
(defun +emacs-lisp--add-doom-elisp-demos-a (fn symbol)
"Add Doom's own demos to `elisp-demos'.
Intended as :around advice for `elisp-demos--search'."
(let ((org-inhibit-startup t)
enable-dir-local-variables
org-mode-hook)
(or (funcall fn symbol)
(with-file-contents! (doom-path doom-docs-dir "examples.org")
(save-excursion
(when (re-search-backward
(format "^\\*+[ \t]+\\(?:TODO \\)?%s$"
(regexp-quote (symbol-name symbol)))
nil t)
(forward-line 1)
(let ((demos
(string-trim
(buffer-substring-no-properties
(point) (if (re-search-forward "^\\*+ " nil t)
(line-beginning-position)
(point-max))))))
(unless (string-blank-p demos)
demos))))))))
;;;###autoload (put 'map! 'indent-plists-as-data t)
;;;###autoload
(defun +emacs-lisp--calculate-lisp-indent-a (&optional parse-start)