diff options
| author | Jakob L. Kreuze | 2021-11-28 09:13:48 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze | 2021-11-28 09:14:12 -0500 |
| commit | b4010f526779db8d8318af41d94c8553d5222357 (patch) | |
| tree | da20ab6e0ce29fd5f0a3d43d21e3f4245318fa60 /lisp | |
| parent | 2c48e9705d4c556698de0c9c84ccf195c48b9b54 (diff) | |
Add quick `notes-page-goto' functions for subdirs
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/documents.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/documents.el b/lisp/documents.el index 56adf58..f825de9 100644 --- a/lisp/documents.el +++ b/lisp/documents.el @@ -178,12 +178,13 @@ Visits LINK, or if LINK names a subdirectory of (notes-file-is-page path))) (notes-hierarchy-paths))) - (defun notes-page-goto () + (defun notes-page-goto (&optional initial-input) "Interactively find a page in `notes-directory'." (interactive) (let* ((hierarchy (notes-hierarchy)) (hierarchy (cl-remove-if-not #'cl-third hierarchy)) - (name (ivy-read "Find file: " (mapcar #'cl-first hierarchy))) + (name (completing-read "Find file: " (mapcar #'cl-first hierarchy) + nil nil initial-input)) (item (cl-find-if #'(lambda (item) (string= name (cl-first item))) hierarchy))) (if item (find-file (cl-second item)) @@ -193,6 +194,8 @@ Visits LINK, or if LINK names a subdirectory of ;; Set up a key binding for quickly querying the wiki. :bind ("C-c w" . notes-page-goto) + ("C-c j" . (lambda () (interactive) (notes-page-goto (format-time-string "Journal/%Y-%m-%d ")))) + ("C-c h" . (lambda () (interactive) (notes-page-goto (format-time-string "Work/%Y-%m-%d ")))) ;; Low-friction means of adding things to my GTD inbox. :config |