unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 66697@debbugs.gnu.org
Subject: bug#66697: 30.0.50; [PATCH] desktop-save-mode with expiring remote buffers
Date: Tue, 24 Oct 2023 15:18:47 +0200	[thread overview]
Message-ID: <87zg0888g8.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <831qdkmdxm.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 24 Oct 2023 14:56:37 +0300")

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

[...]

> Sounds right, but don't you get byte-compiler warnings about
> desktop-files-not-to-save not being known?

I did not get a warning about desktop-files-not-to-save but I get one
about shadowing dired-directory.  So I fixed the patch with this new
one.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-desktop-save-on-remote-dired-bug-66697.patch --]
[-- Type: text/x-patch, Size: 2446 bytes --]

From 6c32d99a9f1e8c813550c5a2540ef41ea2d59844 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Tue, 24 Oct 2023 14:51:04 +0200
Subject: [PATCH] Fix desktop-save on remote dired (bug#66697)

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 | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index cc8c74839b9..4337480e2b5 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-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
-- 
2.42.0


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

  parent reply	other threads:[~2023-10-24 13:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  9:21 bug#66697: 30.0.50; [PATCH] desktop-save-mode with expiring remote buffers Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23 11:41 ` Eli Zaretskii
2023-10-23 12:34   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23 12:47     ` Eli Zaretskii
2023-10-23 12:56       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23 13:25         ` Michael Albinus
2023-10-23 13:33           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23 14:07             ` Michael Albinus
2023-10-23 15:21             ` Michael Albinus
2023-10-23 14:21         ` Eli Zaretskii
2023-10-23 14:55           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23 15:46           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24  9:21           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 11:56             ` Eli Zaretskii
2023-10-24 12:00               ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 13:18               ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-10-31 21:14                 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-01  3:28                   ` Eli Zaretskii
2023-11-01 10:20                     ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-01 12:15                       ` Eli Zaretskii
     [not found]                         ` <87fs0csri9.fsf@ledu-giraud.fr>
2023-12-08 16:02                           ` Andy Moreton
2023-12-09 10:06                           ` Eli Zaretskii
2023-12-09 12:05                             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-09 13:16                               ` Eli Zaretskii
2023-12-09 15:24                                 ` Andy Moreton
2023-12-09 15:45                                   ` Eli Zaretskii
2023-11-04  8:05                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg0888g8.fsf@ledu-giraud.fr \
    --to=bug-gnu-emacs@gnu.org \
    --cc=66697@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).