GNU bug report logs - #66697
30.0.50; [PATCH] desktop-save-mode with expiring remote buffers

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Mon, 23 Oct 2023 09:23:01 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #53 received at 66697 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 66697 <at> debbugs.gnu.org
Subject: Re: bug#66697: 30.0.50; [PATCH] desktop-save-mode with expiring
 remote buffers
Date: Tue, 24 Oct 2023 11:21:21 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:


[...]

> Doesn't this tell that the problem is in dired.el, not in desktop.el?
> The problematic call comes from dired-desktop-buffer-misc-data, not
> from desktop.el.  So it's dired-desktop-buffer-misc-data that needs to
> be fixed.

So I work a bit on 'dired-desktop-buffer-misc-data' and have the
following solution:

[dired.diff (text/x-patch, inline)]
diff --git a/lisp/dired.el b/lisp/dired.el
index cc8c74839b9..cae9f31010a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -4875,22 +4875,30 @@ dired-dnd-handle-file
 (eval-when-compile (require 'desktop))
 (declare-function desktop-file-name "desktop" (filename dirname))
 
+(defun dired-desktop-buffer-save-p (dired-directory)
+  "Should this DIRED-DIRECTORY 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-buffer-save-p dired-directory))
+    (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
[Message part 3 (text/plain, inline)]
WDYT?
-- 
Manuel Giraud

This bug report was last modified 1 year and 166 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.