merge: rewrite-docs
I've omitted docs/*.org from this merge, as there is still work left to do there, but I am pushing the module docs early so folks can benefit from the new docs sooner.
This commit is contained in:
commit
1f8bf7accb
179 changed files with 13125 additions and 8630 deletions
|
@ -9,19 +9,6 @@
|
|||
(let ((file (funcall (or fn #'read-file-name) (format "%s: " (capitalize key)) dir)))
|
||||
(format "%s:%s" key (file-relative-name file dir))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-read-link-description-at-point (&optional default context)
|
||||
"TODO"
|
||||
(if (and (stringp default) (not (string-empty-p default)))
|
||||
(string-trim default)
|
||||
(if-let* ((context (or context (org-element-context)))
|
||||
(context (org-element-lineage context '(link) t))
|
||||
(beg (org-element-property :contents-begin context))
|
||||
(end (org-element-property :contents-end context)))
|
||||
(unless (= beg end)
|
||||
(replace-regexp-in-string
|
||||
"[ \n]+" " " (string-trim (buffer-substring-no-properties beg end)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-define-basic-link (key dir-var &rest plist)
|
||||
"Define a link with some basic completion & fontification.
|
||||
|
@ -166,83 +153,3 @@ exist, and `org-link' otherwise."
|
|||
(user-error "Not in org-mode"))
|
||||
(or (+org-play-gif-at-point-h)
|
||||
(user-error "No gif at point")))
|
||||
|
||||
|
||||
;;
|
||||
;;; Org-link parameters
|
||||
|
||||
;;; doom-module:
|
||||
(defun +org-link--doom-module--read-link (link)
|
||||
(cl-destructuring-bind (category &optional module flag)
|
||||
(let ((desc (+org-read-link-description-at-point link)))
|
||||
(if (string-prefix-p "+" (string-trim-left desc))
|
||||
(list nil nil (intern desc))
|
||||
(mapcar #'intern (split-string desc " " nil))))
|
||||
(list :category category
|
||||
:module module
|
||||
:flag flag)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-link--doom-module-follow-fn (link)
|
||||
(cl-destructuring-bind (&key category module flag)
|
||||
(+org-link--doom-module--read-link link)
|
||||
(when category
|
||||
(let ((doom-modules-dirs (list doom-modules-dir)))
|
||||
(if-let* ((path (doom-module-locate-path category module))
|
||||
(path (or (car (doom-glob path "README.org"))
|
||||
path)))
|
||||
(find-file path)
|
||||
(user-error "Can't find Doom module '%s'" link))))
|
||||
(when flag
|
||||
(goto-char (point-min))
|
||||
(and (re-search-forward "^\\*+ \\(?:TODO \\)?Module Flags")
|
||||
(re-search-forward (format "^\\s-*- %s :: "
|
||||
(regexp-quote (symbol-name flag)))
|
||||
(save-excursion (org-get-next-sibling)
|
||||
(point)))
|
||||
(recenter)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-link--doom-module-face-fn (link)
|
||||
(cl-destructuring-bind (&key category module flag)
|
||||
(+org-link--doom-module--read-link link)
|
||||
(if (doom-module-locate-path category module)
|
||||
`(:inherit org-priority
|
||||
:weight bold)
|
||||
'error)))
|
||||
|
||||
|
||||
;;; doom-package:
|
||||
;;;###autoload
|
||||
(defun +org-link--doom-package-follow-fn (link)
|
||||
"TODO"
|
||||
(doom/describe-package
|
||||
(intern-soft
|
||||
(+org-read-link-description-at-point link))))
|
||||
|
||||
|
||||
;;; kbd:
|
||||
|
||||
(defun +org--describe-kbd (keystr)
|
||||
(dolist (key `(("<leader>" . ,doom-leader-key)
|
||||
("<localleader>" . ,doom-localleader-key)
|
||||
("<prefix>" . ,(if (bound-and-true-p evil-mode)
|
||||
(concat doom-leader-key " u")
|
||||
"C-u"))
|
||||
("<help>" . ,(if (bound-and-true-p evil-mode)
|
||||
(concat doom-leader-key " h")
|
||||
"C-h"))
|
||||
("\\<M-" . "alt-")
|
||||
("\\<S-" . "shift-")
|
||||
("\\<s-" . "super-")
|
||||
("\\<C-" . "ctrl-")))
|
||||
(setq keystr
|
||||
(replace-regexp-in-string (car key) (cdr key)
|
||||
keystr t t)))
|
||||
keystr)
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-read-kbd-at-point (&optional default context)
|
||||
"TODO"
|
||||
(+org--describe-kbd
|
||||
(+org-read-link-description-at-point default context)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue