GNU bug report logs - #31028
27.0.50; Saving shell buffers to a file makes the desktop file unreadable

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Mon, 2 Apr 2018 19:57:02 UTC

Severity: minor

Found in version 27.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Juri Linkov <juri <at> linkov.net>
Subject: bug#31028: closed (Re: bug#31028: 27.0.50; Saving shell buffers
 to a file makes the desktop file unreadable)
Date: Wed, 04 Apr 2018 20:45:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 31028 <at> debbugs.gnu.org.

-- 
31028: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31028
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Juri Linkov <juri <at> linkov.net>
To: 31028-done <at> debbugs.gnu.org
Subject: Re: bug#31028: 27.0.50;
 Saving shell buffers to a file makes the desktop file unreadable
Date: Wed, 04 Apr 2018 23:44:07 +0300
> 2. Still save but properly handle shell buffers on reading, i.e. fix shell-mode
>    to check for nil values such as in this patch:

This solution installed to master.

[Message part 3 (message/rfc822, inline)]
From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50;
 Saving shell buffers to a file makes the desktop file unreadable
Date: Mon, 02 Apr 2018 22:48:38 +0300
[Message part 4 (text/plain, inline)]
1. M-x shell RET
2. C-d (send EOF to exit shell)
3. C-x C-s (save to a file)
4. M-x desktop-save-in-desktop-dir RET
5. Restart Emacs

Loading the desktop file fails because the file buffer is saved with shell-mode,
but on reading shell-mode fails while trying to eval

  (process-command (get-buffer-process (current-buffer)))

where get-buffer-process returns nil that is unacceptable as an arg
to process-command.

Possible solutions:

1. Skip and don't save buffers with shell-mode
   by adding it to the default value of desktop-modes-not-to-save

2. Still save but properly handle shell buffers on reading, i.e. fix shell-mode
   to check for nil values such as in this patch:

[desktop-shell-mode.patch (text/x-diff, inline)]
diff --git a/lisp/shell.el b/lisp/shell.el
index 5c228a5..d4a0556 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -568,8 +568,10 @@ shell-mode
   (setq list-buffers-directory (expand-file-name default-directory))
   ;; shell-dependent assignments.
   (when (ring-empty-p comint-input-ring)
-    (let ((shell (file-name-nondirectory (car
-		   (process-command (get-buffer-process (current-buffer))))))
+    (let ((shell (if (get-buffer-process (current-buffer))
+                     (file-name-nondirectory
+                      (car (process-command (get-buffer-process (current-buffer)))))
+                   ""))
 	  (hsize (getenv "HISTSIZE")))
       (and (stringp hsize)
 	   (integerp (setq hsize (string-to-number hsize)))

This bug report was last modified 7 years and 45 days ago.

Previous Next


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