refactor: remove redundant org code
org-collect-keywords does the job here. No need to reinvent the wheel.
This commit is contained in:
parent
fd844ea18d
commit
cd87cc0cc8
2 changed files with 3 additions and 21 deletions
|
@ -126,11 +126,12 @@ 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))))
|
||||||
(let ((path (org-get-outline-path)))
|
(let ((path (org-get-outline-path))
|
||||||
|
(title (org-collect-keywords '("TITLE") '("TITLE"))))
|
||||||
(list (string-join
|
(list (string-join
|
||||||
(list (string-join
|
(list (string-join
|
||||||
(append (when include-files
|
(append (when include-files
|
||||||
(list (or (+org-get-global-property "TITLE")
|
(list (or (cdr (assoc "TITLE" title))
|
||||||
(file-relative-name (buffer-file-name)))))
|
(file-relative-name (buffer-file-name)))))
|
||||||
path
|
path
|
||||||
(when text
|
(when text
|
||||||
|
|
|
@ -86,25 +86,6 @@
|
||||||
(not (evil-emacs-state-p)))
|
(not (evil-emacs-state-p)))
|
||||||
(evil-insert 1))))
|
(evil-insert 1))))
|
||||||
|
|
||||||
(defun +org--get-property (name &optional bound)
|
|
||||||
(save-excursion
|
|
||||||
(let ((re (format "^#\\+%s:[ \t]*\\([^\n]+\\)" (upcase name))))
|
|
||||||
(goto-char (point-min))
|
|
||||||
(when (re-search-forward re bound t)
|
|
||||||
(buffer-substring-no-properties (match-beginning 1) (match-end 1))))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +org-get-global-property (name &optional file bound)
|
|
||||||
"Get a document property named NAME (string) from an org FILE (defaults to
|
|
||||||
current file). Only scans first 2048 bytes of the document."
|
|
||||||
(unless bound
|
|
||||||
(setq bound 256))
|
|
||||||
(if file
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert-file-contents-literally file nil 0 bound)
|
|
||||||
(+org--get-property name))
|
|
||||||
(+org--get-property name bound)))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +org-get-todo-keywords-for (&optional keyword)
|
(defun +org-get-todo-keywords-for (&optional keyword)
|
||||||
"Returns the list of todo keywords that KEYWORD belongs to."
|
"Returns the list of todo keywords that KEYWORD belongs to."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue