summaryrefslogtreecommitdiffhomepage
path: root/lib/doc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/doc')
-rw-r--r--lib/doc/jao-org-notes.el15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index 2c328c5..3f6e725 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -34,20 +34,16 @@
"--no-heading" "--line-number" "--smart-case" "." "-e"
,(format "^(#.(title|filetags): .*)%s" str)))
-(defvar jao-org-notes--trx "[0-9]+:#\\+\\(file\\)?\\(title\\|tags\\):")
-
(defun jao-org-notes--clean-match (m)
(cons (format "%s %s"
(replace-regexp-in-string "^\\./" "" (car m))
- (replace-regexp-in-string jao-org-notes--trx " (\\2)" (cadr m)))
+ (replace-regexp-in-string "[0-9]+:#\\+\\(file\\)?\\(title\\|tags\\):"
+ " (\\2)" (cadr m)))
(expand-file-name (car m) default-directory)))
(defun jao-org-notes--matches (lines)
(mapcar (lambda (l) (jao-org-notes--clean-match (split-string l "\0" t))) lines))
-(defun jao-org-notes--lookup (_ cands cand)
- (or (cdr (assoc cand cands)) cand))
-
(defvar jao-org-notes--grep-history nil)
(defun jao-org--grep (prompt &optional cat no-req)
@@ -56,13 +52,12 @@
(consult--async-command #'jao-org-notes--rg
(consult--async-transform jao-org-notes--matches))
:prompt prompt
- :lookup #'jao-org-notes--lookup
+ :lookup (lambda (_ cands cand) (or (cdr (assoc cand cands)) cand))
:initial (consult--async-split-initial "")
- :add-history (concat (consult--async-split-initial "") (thing-at-point 'symbol))
+ :add-history (concat (consult--async-split-initial (thing-at-point 'symbol)))
:require-match (not no-req)
:category 'jao-org-notes-lookup
- :history '(:input jao-org-notes--grep-history)
- :sort nil)))
+ :history '(:input jao-org-notes--grep-history))))
(defun jao-org-notes-cats ()
(seq-difference (directory-files jao-org-notes-dir) '("." ".." "attic")))