all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 31028@debbugs.gnu.org
Subject: bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable
Date: Mon, 02 Apr 2018 22:48:38 +0300	[thread overview]
Message-ID: <87in99jvg9.fsf@mail.linkov.net> (raw)

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

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: desktop-shell-mode.patch --]
[-- Type: text/x-diff, Size: 736 bytes --]

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	other threads:[~2018-04-02 19:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 19:48 Juri Linkov [this message]
2018-04-04 20:44 ` bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable Juri Linkov

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

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

  git send-email \
    --in-reply-to=87in99jvg9.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=31028@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.