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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31028 in the body.
You can then email your comments to 31028 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#31028; Package emacs. (Mon, 02 Apr 2018 19:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 02 Apr 2018 19:57:02 GMT) Full text and rfc822 format available.

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

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 1 (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)))

Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Wed, 04 Apr 2018 20:45:02 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Wed, 04 Apr 2018 20:45:02 GMT) Full text and rfc822 format available.

Message #10 received at 31028-done <at> debbugs.gnu.org (full text, mbox):

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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 May 2018 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 2 days ago.

Previous Next


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