docs: add doom-docs-mode & doom-docs-org-mode

These two modes exist to provide a nicer reading experience while
viewing Doom's org documentation from within Emacs; they hide
meta-lines, comments, markup, and more.

They also enable our docs to use IDs for links and keep our ID db
separate from any user ID dbs.
This commit is contained in:
Henrik Lissner 2021-10-16 01:31:57 +02:00 committed by Henrik Lissner
parent b5a2aa48fe
commit 7bc0033d0a
6 changed files with 500 additions and 133 deletions

View file

@ -188,21 +188,6 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
(when-let* ((context (org-element-context))
(path (org-element-property :path context)))
(pcase (org-element-property :type context)
("kbd"
(format "%s %s"
(propertize "Key sequence:" 'face 'bold)
(propertize (+org-read-kbd-at-point path context)
'face 'help-key-binding)))
("doom-module"
(format "%s %s"
(propertize "Doom module:" 'face 'bold)
(propertize (+org-read-link-description-at-point path)
'face 'org-priority)))
("doom-package"
(format "%s %s"
(propertize "Doom package:" 'face 'bold)
(propertize (+org-read-link-description-at-point path)
'face 'org-priority)))
(type (format "Link: %s" (org-element-property :raw-link context))))))
;; Automatic indent detection in org files is meaningless
@ -513,29 +498,9 @@ relative to `org-directory', unless it is an absolute path."
'("gmap" . "https://maps.google.com/maps?q=%s")
'("duckduckgo" . "https://duckduckgo.com/?q=%s")
'("wikipedia" . "https://en.wikipedia.org/wiki/%s")
'("wolfram" . "https://wolframalpha.com/input/?i=%s")
'("doom-repo" . "https://github.com/hlissner/doom-emacs/%s"))
'("wolfram" . "https://wolframalpha.com/input/?i=%s"))
(+org-define-basic-link "org" 'org-directory)
(+org-define-basic-link "doom" 'doom-emacs-dir)
(+org-define-basic-link "doom-docs" 'doom-docs-dir)
(+org-define-basic-link "doom-modules" 'doom-modules-dir)
;; Add "lookup" links for packages and keystrings; useful for Emacs
;; documentation -- especially Doom's!
(org-link-set-parameters
"kbd"
:follow (lambda (_) (minibuffer-message "%s" (+org-display-link-in-eldoc-a)))
:help-echo #'+org-read-kbd-at-point
:face 'help-key-binding)
(org-link-set-parameters
"doom-package"
:follow #'+org-link--doom-package-follow-fn
:face (lambda (_) '(:inherit org-priority :slant italic)))
(org-link-set-parameters
"doom-module"
:follow #'+org-link--doom-module-follow-fn
:face #'+org-link--doom-module-face-fn)
;; Allow inline image previews of http(s)? urls or data uris.
;; `+org-http-image-data-fn' will respect `org-display-remote-inline-images'.