Fix doom/help-* search commands
They weren't actually doing anything.
This commit is contained in:
parent
dce3d0ddc6
commit
01face314d
1 changed files with 31 additions and 18 deletions
|
@ -121,8 +121,8 @@ selection of all minor-modes, active or not."
|
||||||
;;
|
;;
|
||||||
;;; Documentation commands
|
;;; Documentation commands
|
||||||
|
|
||||||
;;;###autoload
|
(defun doom--org-headings (files &optional depth include-files)
|
||||||
(defun doom-completing-read-org-headlings (files &optional depth include-files)
|
"TODO"
|
||||||
(require 'org)
|
(require 'org)
|
||||||
(let* ((default-directory doom-docs-dir)
|
(let* ((default-directory doom-docs-dir)
|
||||||
(org-agenda-files (mapcar #'expand-file-name (doom-enlist files)))
|
(org-agenda-files (mapcar #'expand-file-name (doom-enlist files)))
|
||||||
|
@ -138,7 +138,7 @@ selection of all minor-modes, active or not."
|
||||||
(<= level depth))
|
(<= level depth))
|
||||||
(or (null tags)
|
(or (null tags)
|
||||||
(not (string-match-p ":TOC" tags))))
|
(not (string-match-p ":TOC" tags))))
|
||||||
(list
|
(propertize
|
||||||
(mapconcat
|
(mapconcat
|
||||||
'identity
|
'identity
|
||||||
(list (mapconcat #'identity
|
(list (mapconcat #'identity
|
||||||
|
@ -150,13 +150,24 @@ selection of all minor-modes, active or not."
|
||||||
" > ")
|
" > ")
|
||||||
tags)
|
tags)
|
||||||
" ")
|
" ")
|
||||||
buffer-file-name
|
'location (cons buffer-file-name (point)))))))
|
||||||
(point)))
|
|
||||||
)))
|
|
||||||
t 'agenda))
|
t 'agenda))
|
||||||
(mapc #'kill-buffer org-agenda-new-buffers)
|
(mapc #'kill-buffer org-agenda-new-buffers)
|
||||||
(setq org-agenda-new-buffers nil))))
|
(setq org-agenda-new-buffers nil))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom-completing-read-org-headings (prompt files &optional depth include-files initial-input)
|
||||||
|
"TODO"
|
||||||
|
(if-let* ((result (completing-read
|
||||||
|
prompt
|
||||||
|
(doom--org-headings files depth include-files)
|
||||||
|
nil nil initial-input)))
|
||||||
|
(cl-destructuring-bind (file . location)
|
||||||
|
(get-text-property 0 'location result)
|
||||||
|
(find-file file)
|
||||||
|
(goto-char location))
|
||||||
|
(user-error "Aborted")))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/help ()
|
(defun doom/help ()
|
||||||
"Open Doom's user manual."
|
"Open Doom's user manual."
|
||||||
|
@ -164,25 +175,27 @@ selection of all minor-modes, active or not."
|
||||||
(find-file (expand-file-name "index.org" doom-docs-dir)))
|
(find-file (expand-file-name "index.org" doom-docs-dir)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/help-search ()
|
(defun doom/help-search (&optional initial-input)
|
||||||
"Search Doom's documentation and jump to a headline."
|
"Search Doom's documentation and jump to a headline."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let (ivy-sort-functions-alist)
|
(let (ivy-sort-functions-alist)
|
||||||
(completing-read
|
(doom-completing-read-org-headings
|
||||||
"Find in Doom help: "
|
"Find in Doom help: "
|
||||||
(doom-completing-read-org-headlings (list "getting_started.org"
|
(list "getting_started.org"
|
||||||
"contributing.org"
|
"contributing.org"
|
||||||
"troubleshooting.org"
|
"troubleshooting.org"
|
||||||
"tutorials.org"
|
"tutorials.org"
|
||||||
"faq.org")
|
"faq.org"
|
||||||
2 t))))
|
"../modules/README.org")
|
||||||
|
2 t initial-input)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/help-faq ()
|
(defun doom/help-faq (&optional initial-input)
|
||||||
"Search Doom's FAQ and jump to a question."
|
"Search Doom's FAQ and jump to a question."
|
||||||
(interactive)
|
(interactive)
|
||||||
(completing-read "Find in FAQ: "
|
(doom-completing-read-org-headings
|
||||||
(doom-completing-read-org-headlings (list "faq.org"))))
|
"Find in FAQ: " (list "faq.org")
|
||||||
|
nil nil initial-input))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/help-news ()
|
(defun doom/help-news ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue