]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix desktop-save on remote dired (bug#66697)
authorManuel Giraud <manuel@ledu-giraud.fr>
Tue, 24 Oct 2023 12:51:04 +0000 (14:51 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 4 Nov 2023 08:03:33 +0000 (10:03 +0200)
Do not gather "misc data" for dired buffer not meant to be
desktop saved.

lisp/dired.el (dired-desktop-save-p): New function to test if
`dired-directory' should be desktop saved.
(dired-desktop-buffer-misc-data): Use it.

lisp/dired.el

index 99156b283659ee629699f0798e779a5505e84950..c710e06722fb04c77878c79e923440fd787445a2 100644 (file)
@@ -4877,22 +4877,30 @@ Ask means pop up a menu for the user to select one of copy, move or link."
 (eval-when-compile (require 'desktop))
 (declare-function desktop-file-name "desktop" (filename dirname))
 
+(defun dired-desktop-save-p ()
+  "Should `dired-directory' be desktop saved?"
+  (if (consp dired-directory)
+      (not (string-match-p desktop-files-not-to-save (car dired-directory)))
+    (not (string-match-p desktop-files-not-to-save dired-directory))))
+
 (defun dired-desktop-buffer-misc-data (dirname)
   "Auxiliary information to be saved in desktop file."
-  (cons
-   ;; Value of `dired-directory'.
-   (if (consp dired-directory)
-       ;; Directory name followed by list of files.
-       (cons (desktop-file-name (car dired-directory) dirname)
-             (cdr dired-directory))
-     ;; Directory name, optionally with shell wildcard.
-     (desktop-file-name dired-directory dirname))
-   ;; Subdirectories in `dired-subdir-alist'.
-   (cdr
-    (nreverse
-     (mapcar
-      (lambda (f) (desktop-file-name (car f) dirname))
-      dired-subdir-alist)))))
+  (when (and (stringp desktop-files-not-to-save)
+             (dired-desktop-save-p))
+    (cons
+     ;; Value of `dired-directory'.
+     (if (consp dired-directory)
+         ;; Directory name followed by list of files.
+         (cons (desktop-file-name (car dired-directory) dirname)
+               (cdr dired-directory))
+       ;; Directory name, optionally with shell wildcard.
+       (desktop-file-name dired-directory dirname))
+     ;; Subdirectories in `dired-subdir-alist'.
+     (cdr
+      (nreverse
+       (mapcar
+        (lambda (f) (desktop-file-name (car f) dirname))
+        dired-subdir-alist))))))
 
 (defun dired-restore-desktop-buffer (_file-name
                                      _buffer-name