branch: externals/denote commit 721235b47e14047fb9173fa33aa2ecc8f4a1dda1 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Revert "Make 'denote-directory-files' accept optional DIRECTORY" This reverts commit c0df642eca54090047c4bedb8989fb45e2e8a51a. We will use the approach suggested by Jean-Philippe Gagné Guay in issue 559, namely, to 'let' bind the denote-directory where we need to without adding too many parameters to the 'denote-directory-files': <https://github.com/protesilaos/denote/issues/559>. --- README.org | 48 ++++++++++++++++++++++++------------------------ denote.el | 21 +++++++++------------ 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/README.org b/README.org index 6321a107f7..df6c4a6510 100644 --- a/README.org +++ b/README.org @@ -4867,19 +4867,19 @@ The following sections cover the specifics. #+findex: denote-directory-files + Function ~denote-directory-files~ :: Return list of absolute file - paths in variable ~denote-directory~ or optional =DIRECTORY=. Files - that match ~denote-excluded-files-regexp~ are excluded from the - list. Files only need to have an identifier. The return value may - thus include file types that are not implied by ~denote-file-type~. - With optional =FILES-MATCHING-REGEXP=, restrict files to those - matching the given regular expression. With optional =OMIT-CURRENT= - as a non-nil value, do not include the current Denote file in the - returned list. With optional =TEXT-ONLY= as a non-nil value, limit - the results to text files that satisfy ~denote-file-is-note-p~. With - optional =EXCLUDE-REGEXP= exclude the files that match the given - regular expression. This is done after =FILES-MATCHING-REGEXP= and - =OMIT-CURRENT= have been applied. [ The optional =EXCLUDE-REGEXP= - and =DIRECTORY= are part of {{{development-version}}}. ] + paths in variable ~denote-directory~. Files that match + ~denote-excluded-files-regexp~ are excluded from the list. Files + only need to have an identifier. The return value may thus include + file types that are not implied by ~denote-file-type~. With optional + =FILES-MATCHING-REGEXP=, restrict files to those matching the given + regular expression. With optional =OMIT-CURRENT= as a non-nil value, + do not include the current Denote file in the returned list. With + optional =TEXT-ONLY= as a non-nil value, limit the results to text + files that satisfy ~denote-file-is-note-p~. With optional + =EXCLUDE-REGEXP= exclude the files that match the given regular + expression. This is done after =FILES-MATCHING-REGEXP= and + =OMIT-CURRENT= have been applied. [ The optional =EXCLUDE-REGEXP= is + part of {{{development-version}}}. ] #+findex: denote-directory-subdirectories + Function ~denote-directory-subdirectories~ :: Return list of @@ -6177,17 +6177,17 @@ Denote is meant to be a collective effort. Every bit of help matters. Rajput, Jean-Charles Bagneris, Jeff Valk, Jens Östlund, Jeremy Friesen, Jonathan Sahar, Johan Bolmsjö, Jonas Großekathöfer, Jousimies, Juanjo Presa, Julian Hoch, Kai von Fintel, Kaushal Modi, - Kevin McCarthy, Kolmas, Lukas C. Bossert, M. Hadi Timachi, Maikol - Solis, Mark Olson, Mirko Hernandez, Niall Dooley, Nick Bell, Oliver - Epper, Paul van Gelder, Peter Prevos, Peter Smith, Riccardo - Giannitrapani, Samuel W. Flint, Sergio Rey, Suhail Singh, Shreyas - Ragavan, Stefan Thesing, Summer Emacs, Sven Seebeck, Taoufik, TJ - Stankus, Vick (VicZz), Viktor Haag, Vineet C. Kulkarni, Wade - Mealing, Wilf, Yi Liu, Ypot, atanasj, azegas, babusri, bdillahu, - coherentstate, doolio, duli, drcxd, elge70, elliottw, fingerknight, - hpgisler, hyperfocus1337, jtpavlock, juh, leafarbelm, - mentalisttraceur, pRot0ta1p, rbenit68, relict007, sarcom-sar, - sienic, skissue, sundar bp, yetanotherfossman, zadca123 + Kolmas, Lukas C. Bossert, M. Hadi Timachi, Maikol Solis, Mark Olson, + Mirko Hernandez, Niall Dooley, Nick Bell, Oliver Epper, Paul van + Gelder, Peter Prevos, Peter Smith, Riccardo Giannitrapani, Samuel W. + Flint, Sergio Rey, Suhail Singh, Shreyas Ragavan, Stefan Thesing, + Summer Emacs, Sven Seebeck, Taoufik, TJ Stankus, Vick (VicZz), + Viktor Haag, Vineet C. Kulkarni, Wade Mealing, Wilf, Yi Liu, Ypot, + atanasj, azegas, babusri, bdillahu, coherentstate, doolio, duli, + drcxd, elge70, elliottw, fingerknight, hpgisler, hyperfocus1337, + jtpavlock, juh, leafarbelm, mentalisttraceur, pRot0ta1p, rbenit68, + relict007, sarcom-sar, sienic, skissue, sundar bp, + yetanotherfossman, zadca123 Special thanks to Peter Povinec who helped refine the file-naming scheme, which is the cornerstone of this project. diff --git a/denote.el b/denote.el index e5eca09734..2421d5e6b4 100644 --- a/denote.el +++ b/denote.el @@ -1267,12 +1267,12 @@ Return t if FILE is valid, else return nil." ((denote--exclude-directory-regexp-p rel) nil) ((file-readable-p file))))) -(defun denote--directory-all-files-recursively (&optional directory) - "Return list of all files in variable `denote-directory' or optional DIRECTORY. +(defun denote--directory-all-files-recursively () + "Return list of all files in variable `denote-directory'. Avoids traversing dotfiles (unconditionally) and whatever matches `denote-excluded-directories-regexp'." (directory-files-recursively - (or directory (denote-directory)) + (denote-directory) directory-files-no-dot-files-regexp :include-directories #'denote--directory-files-recursively-predicate @@ -1283,13 +1283,10 @@ Avoids traversing dotfiles (unconditionally) and whatever matches (and denote-excluded-files-regexp (string-match-p denote-excluded-files-regexp file))) -(defun denote--directory-get-files (&optional directory) +(defun denote--directory-get-files () "Return list with full path of valid files in variable `denote-directory'. Consider files that satisfy `denote-file-has-identifier-p' and -are not backups. - -With optional DIRECTORY, use that instead of the variable -`denote-directory'." +are not backups." (mapcar #'expand-file-name (seq-filter @@ -1298,10 +1295,10 @@ With optional DIRECTORY, use that instead of the variable (denote-file-has-identifier-p file) (not (denote--file-excluded-p file)) (not (backup-file-name-p file)))) - (denote--directory-all-files-recursively directory)))) + (denote--directory-all-files-recursively)))) -(defun denote-directory-files (&optional files-matching-regexp omit-current text-only exclude-regexp directory) - "Return absolute file paths in variable `denote-directory' or optional DIRECTORY. +(defun denote-directory-files (&optional files-matching-regexp omit-current text-only exclude-regexp) + "Return list of absolute file paths in variable `denote-directory'. Files that match `denote-excluded-files-regexp' are excluded from the list. @@ -1321,7 +1318,7 @@ text files that satisfy `denote-file-has-supported-extension-p'. With optional EXCLUDE-REGEXP exclude the files that match the given regular expression. This is done after FILES-MATCHING-REGEXP and OMIT-CURRENT have been applied." - (let ((files (denote--directory-get-files directory))) + (let ((files (denote--directory-get-files))) (when (and omit-current buffer-file-name (denote-file-has-identifier-p buffer-file-name)) (setq files (delete buffer-file-name files))) (when files-matching-regexp