tweak(org): have doom links use path for info
This commit is contained in:
parent
5ac2a5258b
commit
24f98d49ec
2 changed files with 16 additions and 19 deletions
|
@ -77,36 +77,36 @@ exist, and `org-link' otherwise."
|
|||
keystr t t)))
|
||||
keystr)
|
||||
|
||||
(defun +org-link--read-module-link (link)
|
||||
(defun +org-link--read-module-spec (module-spec-str)
|
||||
(cl-destructuring-bind (category &optional module flag)
|
||||
(let ((desc (+org-link-read-desc-at-point link)))
|
||||
(if (string-prefix-p "+" (string-trim-left desc))
|
||||
(list nil nil (intern desc))
|
||||
(mapcar #'intern (split-string desc " " nil))))
|
||||
(if (string-prefix-p "+" (string-trim-left module-spec-str))
|
||||
(list nil nil (intern module-spec-str))
|
||||
(mapcar #'intern (split-string module-spec-str " " nil)))
|
||||
(list :category category
|
||||
:module module
|
||||
:flag flag)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-link--doom-module-link-face-fn (link)
|
||||
(defun +org-link--doom-module-link-face-fn (module-path)
|
||||
(cl-destructuring-bind (&key category module flag)
|
||||
(+org-link--read-module-link link)
|
||||
(+org-link--read-module-spec module-path)
|
||||
(if (doom-module-locate-path category module)
|
||||
`(:inherit org-priority
|
||||
:weight bold)
|
||||
'error)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-link-follow-doom-module-fn (link)
|
||||
(defun +org-link-follow-doom-module-fn (module-path _prefixarg)
|
||||
"TODO"
|
||||
(cl-destructuring-bind (&key category module flag)
|
||||
(+org-link--read-module-link link)
|
||||
(+org-link--read-module-spec module-path)
|
||||
(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))))
|
||||
(user-error "Can't find Doom module '%s'" module-path))))
|
||||
(when flag
|
||||
(goto-char (point-min))
|
||||
(when (and (re-search-forward "^\\*+ \\(?:TODO \\)?Module flags")
|
||||
|
@ -118,11 +118,9 @@ exist, and `org-link' otherwise."
|
|||
(recenter)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-link-follow-doom-package-fn (link)
|
||||
(defun +org-link-follow-doom-package-fn (pkg _prefixarg)
|
||||
"TODO"
|
||||
(doom/describe-package
|
||||
(intern-soft
|
||||
(+org-link-read-desc-at-point link))))
|
||||
(doom/describe-package (intern-soft pkg)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -542,11 +542,10 @@ relative to `org-directory', unless it is an absolute path."
|
|||
;; Add "lookup" links for packages and keystrings; useful for Emacs
|
||||
;; documentation -- especially Doom's!
|
||||
(letf! ((defun -call-interactively (fn)
|
||||
(lambda (link)
|
||||
(let ((desc (+org-link-read-desc-at-point link)))
|
||||
(funcall
|
||||
fn (or (intern-soft desc)
|
||||
(user-error "Can't find documentation for %S" desc))))))
|
||||
(lambda (path _prefixarg)
|
||||
(funcall
|
||||
fn (or (intern-soft path)
|
||||
(user-error "Can't find documentation for %S" path)))))
|
||||
(defun -eldoc-fn (label face)
|
||||
(lambda (context)
|
||||
(format "%s %s"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue