Do for the keyword include/exclude commands the same as commit 9b8c96f

This commit is contained in:
Protesilaos 2026-04-28 23:31:03 +03:00
parent 9b8c96f5e8
commit 06c520de36
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -6024,9 +6024,11 @@ KEYWORDS is a list of strings."
(format "_%s" (regexp-opt keywords)) (format "_%s" (regexp-opt keywords))
(error "KEYWORDS must be a list of strings; got `%S'" keywords))) (error "KEYWORDS must be a list of strings; got `%S'" keywords)))
;; TODO 2026-04-06: The `denote-query-exclude-files-with-keywords' and (defun denote-query--filter-keywords (keywords include-p)
;; the `denote-query-include-files-with-keywords' can be defined via a "Filter `denote-query--last-files' with KEYWORDS.
;; macro. If INCLUDE-P is non-nil, only include matches. Otherwise exclude them."
(denote-query--filter-files (denote-query--keywords-as-regexp keywords) include-p))
(defun denote-query-exclude-files-with-keywords (keywords) (defun denote-query-exclude-files-with-keywords (keywords)
"Exclude files with KEYWORDS from current query buffer. "Exclude files with KEYWORDS from current query buffer.
@ -6038,19 +6040,17 @@ Interactively, KEYWORDS are read from the minibuffer using
(or (denote--user-error-if-not-major-mode 'denote-query-mode) (or (denote--user-error-if-not-major-mode 'denote-query-mode)
(list (denote-keywords-prompt "Exclude files with keywords"))) (list (denote-keywords-prompt "Exclude files with keywords")))
denote-query-mode) denote-query-mode)
(denote--user-error-if-not-major-mode 'denote-query-mode) (denote-query--filter-keywords keywords nil))
(denote-query-exclude-files (denote-query--keywords-as-regexp keywords)))
(defun denote-query-only-include-files-with-keywords (keywords) (defun denote-query-only-include-files-with-keywords (keywords)
"Exclude files without KEYWORDS from current query buffer. "Only show files with KEYWORDS in the current Denote query buffer.
See `denote-query-exclude-files-with-keywords' for details." See `denote-query-exclude-files-with-keywords' for details."
(interactive (interactive
(or (denote--user-error-if-not-major-mode 'denote-query-mode) (or (denote--user-error-if-not-major-mode 'denote-query-mode)
(list (denote-keywords-prompt "Only include files with keywords"))) (list (denote-keywords-prompt "Only include files with keywords")))
denote-query-mode) denote-query-mode)
(denote--user-error-if-not-major-mode 'denote-query-mode) (denote-query--filter-keywords keywords :include))
(denote-query-only-include-files (denote-query--keywords-as-regexp keywords)))
(defun denote-query-clear-all-filters () (defun denote-query-clear-all-filters ()
"Run last search with the full set of files in the variable `denote-directory'. "Run last search with the full set of files in the variable `denote-directory'.