diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-11-12 23:17:42 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-11-12 23:17:42 -0500 |
commit | b33607b0e3fd6f9813d1ec0bbf544d5bc060ee16 (patch) | |
tree | e964004cc3f70337b05f038e11a628d7ce92f976 /bog.el | |
parent | c131c794aeafe4f4797735ba01c2850ea0537dac (diff) | |
download | bog-b33607b0e3fd6f9813d1ec0bbf544d5bc060ee16.tar.gz |
Restructure search functions
Use `bog-search-notes' in `bog-search-notes-for-citekey' instead of
repeating logic. The STRING argument added to `bog-search-notes' follows
`org-search-view'.
Diffstat (limited to 'bog.el')
-rw-r--r-- | bog.el | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -682,14 +682,16 @@ level `bog-refile-maxlevel' are considered." (concat (file-name-as-directory bog-notes-directory) "*.org"))) -(defun bog-search-notes (&optional todo-only) +(defun bog-search-notes (&optional todo-only string) "Search notes using `org-search-view'. -With prefix argument TODO-ONLY, only TODO entries are searched." +With prefix argument TODO-ONLY, only TODO entries are searched. +If STRING is non-nil, this will be used as the search +term (instead of prompting the user for one)." (interactive "P") (let ((lprops '((org-agenda-files (bog-notes-files)) (org-agenda-text-search-extra-files nil)))) (put 'org-agenda-redo-command 'org-lprops lprops) - (org-let lprops '(org-search-view todo-only)))) + (org-let lprops '(org-search-view todo-only string)))) (defun bog-search-notes-for-citekey (&optional todo-only) "Search notes for citekey using `org-search-view'. @@ -701,11 +703,7 @@ The citekey will be taken from the text under point if it matches not found, a prompt will open to select from all citekeys present in notes." (interactive "P") - (let ((citekey (bog-citekey-from-notes-or-all nil)) - (lprops '((org-agenda-files (bog-notes-files)) - (org-agenda-text-search-extra-files nil)))) - (put 'org-agenda-redo-command 'org-lprops lprops) - (org-let lprops '(org-search-view todo-only citekey)))) + (bog-search-notes todo-only (bog-citekey-from-notes-or-all nil))) (defun bog-sort-topic-headings-in-buffer (&optional sorting-type) "Sort topic headings in this buffer. |