[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 9c24528b3d 08/10: Define revert-buffer-function
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 9c24528b3d 08/10: Define revert-buffer-function for denote-sort-dired |
Date: |
Tue, 5 Dec 2023 03:58:14 -0500 (EST) |
branch: externals/denote
commit 9c24528b3df13547652b424374ebec9dbf7f8a9f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Define revert-buffer-function for denote-sort-dired
---
denote-sort.el | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/denote-sort.el b/denote-sort.el
index 2dae139d3c..a46d3f57e4 100644
--- a/denote-sort.el
+++ b/denote-sort.el
@@ -156,16 +156,12 @@ With optional REVERSE as a non-nil value, reverse the
sort order."
denote-sort-components nil :require-match
nil 'denote-sort--component-hist default))))
-(defun denote-sort--prepare-dired (buffer-name files)
- "Return Dired buffer with BUFFER-NAME showing FILES.
-FILES are stripped of their directory component and are displayed
-relative to the variable `denote-directory'."
- (let ((default-directory (denote-directory)))
- (dired (cons buffer-name (mapcar #'file-relative-name files)))))
+(defvar-local denote-sort--dired-buffer nil
+ "Buffer object of current `denote-sort-dired'.")
;;;###autoload
(defun denote-sort-dired (files-matching-regexp sort-by-component reverse)
- "Produce Dired buffer with sorted files from variable `denote-directory'.
+ "Produce Dired dired-buffer with sorted files from variable
`denote-directory'.
When called interactively, prompt for FILES-MATCHING-REGEXP,
SORT-BY-COMPONENT, and REVERSE.
@@ -184,17 +180,24 @@ a non-nil value, respectively."
(denote-sort--files-matching-regexp-prompt)
(denote-sort-component-prompt)
(y-or-n-p "Reverse sort? ")))
- (denote-sort--prepare-dired
- ;; NOTE 2023-12-04: Passing the FILES-MATCHING-REGEXP here produces
- ;; an error if the regexp contains a wildcard for a directory. I
- ;; can reproduce this in emacs -Q and am not sure if it is a bug.
- ;; Anyway, I will report it upstream, but even if it is fixed we
- ;; cannot use it for now (whatever fix will be available for Emacs
- ;; 30+).
- ;;
- ;; (format "Denote sort `%s' by `%s'" files-matching-regexp
sort-by-component)
- (format "Denote sort by `%s'" sort-by-component)
- (denote-sort-get-directory-files files-matching-regexp sort-by-component
reverse))
+ (let* ((default-directory (denote-directory))
+ ;; NOTE 2023-12-04: Passing the FILES-MATCHING-REGEXP here produces
+ ;; an error if the regexp contains a wildcard for a directory. I
+ ;; can reproduce this in emacs -Q and am not sure if it is a bug.
+ ;; Anyway, I will report it upstream, but even if it is fixed we
+ ;; cannot use it for now (whatever fix will be available for Emacs
+ ;; 30+).
+ ;;
+ ;; (format "Denote sort `%s' by `%s'" files-matching-regexp
sort-by-component)
+ (buffer-name (format "Denote sort by `%s'" sort-by-component))
+ (files (denote-sort-get-directory-files files-matching-regexp
sort-by-component reverse))
+ (dired-buffer (dired (cons buffer-name (mapcar #'file-relative-name
files)))))
+ (setq denote-sort--dired-buffer dired-buffer)
+ (with-current-buffer dired-buffer
+ (setq-local revert-buffer-function
+ (lambda (&rest _)
+ (kill-buffer dired-buffer)
+ (denote-sort-dired files-matching-regexp sort-by-component
reverse)))))
;; Because of the above NOTE, I am printing a message. Not what I
;; want, but it is better than nothing...
(message "Denote sort `%s' by `%s'" files-matching-regexp sort-by-component))
- [elpa] externals/denote updated (f1a942f2e7 -> a44b129601), ELPA Syncer, 2023/12/05
- [elpa] externals/denote 9f0ecc8d65 02/10: Add missing REVERSE argument in denote-org-dblock--files, ELPA Syncer, 2023/12/05
- [elpa] externals/denote 2add39ecd7 03/10: Support signature links in denote-org-dblock--get-file-contents, ELPA Syncer, 2023/12/05
- [elpa] externals/denote 860c5cca22 06/10: Show relative current file name in rename commands, ELPA Syncer, 2023/12/05
- [elpa] externals/denote 349b1ef898 07/10: Use correct indentation in denote-sort-files, ELPA Syncer, 2023/12/05
- [elpa] externals/denote 9c24528b3d 08/10: Define revert-buffer-function for denote-sort-dired,
ELPA Syncer <=
- [elpa] externals/denote a44b129601 10/10: Update doc string of 'denote-org-dblock-insert-backlinks', ELPA Syncer, 2023/12/05
- [elpa] externals/denote 9d6b50b0c1 09/10: Add single prompt function for all "files matching regexp" type of prompts, ELPA Syncer, 2023/12/05
- [elpa] externals/denote 378873e83a 01/10: Make denote--keywords-add-to-history work only on a list, ELPA Syncer, 2023/12/05
- [elpa] externals/denote c4b3187039 04/10: Make 'denote-files' Org dynamic block file separator opt-in, ELPA Syncer, 2023/12/05
- [elpa] externals/denote 0fe7122f70 05/10: Store denote-link-with-signature format in a private variable, ELPA Syncer, 2023/12/05