emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/embark e51a010627 2/4: embark-export-dired: Ensure that


From: ELPA Syncer
Subject: [elpa] externals/embark e51a010627 2/4: embark-export-dired: Ensure that no Dired buffer is reused (Fix #675)
Date: Sat, 4 Nov 2023 21:57:52 -0400 (EDT)

branch: externals/embark
commit e51a010627ae1b39ca3afddb75ec95f530c4f0cf
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    embark-export-dired: Ensure that no Dired buffer is reused (Fix #675)
---
 embark.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/embark.el b/embark.el
index 315d56b0ab..861dc95ba1 100644
--- a/embark.el
+++ b/embark.el
@@ -3339,14 +3339,16 @@ PRED is a predicate function used to filter the items."
                    (let ((file (file-name-nondirectory path)))
                      (or (string= file ".") (string= file ".."))))
                  files)))
-  (let* ((dir (or (file-name-directory (try-completion "" files)) ""))
-         (buf (dired-noselect
-               (cons (expand-file-name dir)
-                     (mapcar (lambda (file) (string-remove-prefix dir file))
-                             files)))))
-    ;; unadvertise this buffer to avoid reuse
+  (cl-letf* ((dir (or (file-name-directory (try-completion "" files)) ""))
+             ;; Prevent reusing existing Dired buffer.
+             ((symbol-function 'dired-find-buffer-nocreate) #'ignore)
+             (buf (dired-noselect
+                   (cons (expand-file-name dir)
+                         (mapcar (lambda (file) (string-remove-prefix dir 
file))
+                                 files)))))
     (with-current-buffer buf
-      (dired-unadvertise (car dired-directory)) ; avoid reuse of this buffer
+      ;; Unadvertise to prevent the new buffer from being reused.
+      (dired-unadvertise (car dired-directory))
       (rename-buffer (format "*Embark Export Dired %s*" default-directory)))
     (pop-to-buffer buf)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]