commit d8c85e370fdb82e0b757315a9d06baab372443ff
parent b4e48a8729031496cce97a173a43442724d478d4
Author: andsy10 <andsy1016@gmail.com>
Date: Fri, 16 Oct 2026 08:37:43 +0800
Replace default consult-denote commands
Diffstat:
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el
@@ -414,7 +414,8 @@
:prefix "C-c j"
"o" #'my-denote-journal-open-entry
"n" #'denote-journal-new-or-existing-entry
- "f" #'my-denote-journal-find-file)
+ "f" #'my-denote-journal-find-file
+ "g" #'my-consult-denote-journal-grep)
;; m for media
(general-def
@@ -436,7 +437,7 @@
:prefix "C-c o"
"f" #'my-denote-find-file
"F" #'my-blog-find-file
- "g" #'consult-denote-grep
+ "g" #'my-consult-denote-grep
"G" #'my-blog-grep
"s" #'my-consult-org-agenda
"C" #'calendar
diff --git a/lisp/init-org.el b/lisp/init-org.el
@@ -88,7 +88,31 @@
:demand t
:config
(consult-denote-mode)
- (setq consult-denote-buffer-sources nil))
+ (setq consult-denote-buffer-sources nil)
+ :init
+ (defvar my-denote-exclude-file-glob '("*==archive*" "*==journal*"))
+
+ (defun my-consult-denote-grep (arg)
+ "Call `consult-denote-grep-command' in the variable `denote-directory'."
+ (interactive "P")
+ (let* ((default-directory denote-directory)
+ (excludes (and (not arg)
+ (mapcar (lambda (g) (concat "--exclude=" g))
+ my-denote-exclude-file-glob)))
+ (consult-grep-args
+ `("grep" (consult--grep-exclude-args) ,@excludes
+ "--null --line-buffered --color=never --ignore-case --with-filename --line-number -I -r")))
+ (funcall-interactively consult-denote-grep-command)))
+
+ (defun my-consult-denote-journal-grep ()
+ "Call `consult-denote-grep-command' in the variable `denote-journal-directory'."
+ (interactive)
+ (let* ((default-directory denote-directory)
+ (includes (format "--include=*==%s*" denote-journal-signature))
+ (consult-grep-args
+ `("grep" (consult--grep-exclude-args) ,includes
+ "--null --line-buffered --color=never --ignore-case --with-filename --line-number -I -r")))
+ (funcall-interactively consult-denote-grep-command))))
;; denote
(my-use-package denote