all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable
@ 2018-04-02 19:48 Juri Linkov
  2018-04-04 20:44 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Juri Linkov @ 2018-04-02 19:48 UTC (permalink / raw)
  To: 31028

[-- 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)))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable
  2018-04-02 19:48 bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable Juri Linkov
@ 2018-04-04 20:44 ` Juri Linkov
  0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2018-04-04 20:44 UTC (permalink / raw)
  To: 31028-done

> 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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-04 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-02 19:48 bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable Juri Linkov
2018-04-04 20:44 ` Juri Linkov

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.