branch: externals/denote commit 5b0a02d1620f7a462f95f3fddcd991cbe5ebd2ae Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Revise denote-sort-dired buffer setup We want the buffer to revert properly. Files that do not exist anymore should not inhibit it and subsequent calls to 'denote-sort-dired' should use their own separate buffer. This was discussed at length in issue 618 with the participation of Alan Schmitt and Rory Molinari: <https://github.com/protesilaos/denote/issues/618>. --- README.org | 16 ++++++++-------- denote.el | 12 +++++++++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.org b/README.org index 20ae7500c1..584539de0e 100644 --- a/README.org +++ b/README.org @@ -6435,14 +6435,14 @@ Denote is meant to be a collective effort. Every bit of help matters. Kolmas, Lukas C. Bossert, M. Hadi Timachi, Maikol Solis, Mark Olson, Mirko Hernandez, Morten Kjeldgaard, 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,johkneisl, jtpavlock, juh, leafarbelm, - mentalisttraceur, mjkalyan, oatmealm, pRot0ta1p, rbenit68, - relict007, sarcom-sar, sienic, skissue, sundar bp, + Giannitrapani, Rory Molinari, 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,johkneisl, jtpavlock, juh, + leafarbelm, mentalisttraceur, mjkalyan, oatmealm, pRot0ta1p, + rbenit68, relict007, sarcom-sar, sienic, skissue, sundar bp, yetanotherfossman, zadca123 Special thanks to Peter Povinec who helped refine the file-naming diff --git a/denote.el b/denote.el index a415bd8092..8d2a3e5141 100644 --- a/denote.el +++ b/denote.el @@ -1876,7 +1876,17 @@ When called from Lisp, the arguments are a string, a symbol among (let ((dired-buffer (dired (cons default-directory (if single-dir-p (mapcar #'file-relative-name files) files)))) (buffer-name (funcall denote-sort-dired-buffer-name-function files-matching-regexp component reverse-sort exclude-rx))) (with-current-buffer dired-buffer - (rename-buffer buffer-name :unique)) + (rename-buffer buffer-name :unique) + (setq-local revert-buffer-function + (lambda (&rest _) + (if-let* ((default-directory (if single-dir-p + (car (denote-directories)) + (denote-sort-dired--find-common-directory (denote-directories)))) + (all-files (denote-sort-get-directory-files files-matching-regexp component reverse-sort nil exclude-rx)) + (files (if single-dir-p (mapcar #'file-relative-name all-files) all-files))) + (setq-local dired-directory (cons default-directory files))) + (dired-revert))) + (revert-buffer)) buffer-name) (message "No matching files for: %s" files-matching-regexp))))