Fix stringp errors in doom/help search commands

This commit is contained in:
Henrik Lissner 2019-05-15 20:51:52 -04:00
parent a8300a53f1
commit c612ba58a9
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -121,28 +121,26 @@ selection of all minor-modes, active or not."
;; ;;
;;; Documentation commands ;;; Documentation commands
(defun doom--org-headings (files &optional depth _prompt include-files) (defun doom--org-headings (files &optional depth include-files)
(require 'org) (require 'org)
(let ((org-agenda-files (doom-enlist files)) (let* ((default-directory doom-docs-dir)
(default-directory doom-docs-dir)) (org-agenda-files (mapcar #'expand-file-name (doom-enlist files)))
(depth (if (integerp depth) depth)))
(unwind-protect (unwind-protect
(delq nil (delq nil
(org-map-entries (org-map-entries
(lambda () (lambda ()
(let* ((components (org-heading-components)) (cl-destructuring-bind (level _reduced-level _todo _priority text tags)
(path (org-get-outline-path)) (org-heading-components)
(level (nth 0 components)) (let ((path (org-get-outline-path)))
(text (nth 4 components)) (when (and (or (null depth)
(tags (nth 5 components))) (<= level depth))
(when (and (or (not depth) (or (null tags)
(and (integerp depth)
(<= level depth)))
(or (not tags)
(not (string-match-p ":TOC" tags)))) (not (string-match-p ":TOC" tags))))
(list (list
(mapconcat (mapconcat
'identity 'identity
(list (mapconcat 'identity (list (mapconcat #'identity
(append (when include-files (append (when include-files
(list (or (+org-get-property "TITLE") (list (or (+org-get-property "TITLE")
(file-relative-name buffer-file-name)))) (file-relative-name buffer-file-name))))
@ -152,9 +150,9 @@ selection of all minor-modes, active or not."
tags) tags)
" ") " ")
buffer-file-name buffer-file-name
(point))))) (point)))
nil )))
'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))))
@ -175,7 +173,7 @@ selection of all minor-modes, active or not."
"troubleshooting.org" "troubleshooting.org"
"tutorials.org" "tutorials.org"
"faq.org") "faq.org")
2 nil t)))) 2 t))))
;;;###autoload ;;;###autoload
(defun doom/help-faq () (defun doom/help-faq ()