branch: externals/denote commit e1c45e25f445171034ecf6aca6e4d99f8139c2e7 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Optionally no current in files in dir regexp match --- denote.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/denote.el b/denote.el index a4e4ef9fbe..35447baccb 100644 --- a/denote.el +++ b/denote.el @@ -291,15 +291,19 @@ names that are relative to the variable `denote-directory'." (file-directory-p file)) (directory-files dir absolute directory-files-no-dot-files-regexp t)))) -(defun denote--directory-files-matching-regexp (regexp) - "Return list of files matching REGEXP." +(defun denote--directory-files-matching-regexp (regexp &optional no-check-current) + "Return list of files matching REGEXP. +With optional NO-CHECK-CURRENT do not test if the current file is +part of the list." (delq nil - (mapcar (lambda (f) - (when (and (string-match-p regexp f) - (not (string= (file-name-nondirectory (buffer-file-name)) f))) - f)) - (denote--directory-files)))) + (mapcar + (lambda (f) + (when (and (string-match-p regexp f) + (or no-check-current + (not (string= (file-name-nondirectory (buffer-file-name)) f)))) + f)) + (denote--directory-files)))) (defun denote--keywords-in-files () "Produce list of keywords in `denote--directory-files'."