Fix desktop-save for dired buffers (bug#66697)

* lisp/dired.el (dired-desktop-save-p): Move all logic here.  Carry on
when 'desktop-files-not-to-save' is nil.
(dired-desktop-buffer-misc-data): Use it.
This commit is contained in:
Manuel Giraud 2023-12-09 13:02:19 +01:00 committed by Eli Zaretskii
parent 20be8ed61f
commit 127de202b8

View file

@ -4989,14 +4989,15 @@ Ask means pop up a menu for the user to select one of copy, move or link."
(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))))
(or (null desktop-files-not-to-save)
(and (stringp desktop-files-not-to-save)
(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."
(when (and (stringp desktop-files-not-to-save)
(dired-desktop-save-p))
(when (dired-desktop-save-p)
(cons
;; Value of `dired-directory'.
(if (consp dired-directory)