From unknown Tue Jun 17 22:27:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2018 19:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 31028 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 31028@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.152269896314585 (code B ref -1); Mon, 02 Apr 2018 19:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Apr 2018 19:56:03 +0000 Received: from localhost ([127.0.0.1]:35431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f35Yh-0003n1-9Y for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:56:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f35Yf-0003mM-9E for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:56:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f35YY-000634-U0 for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:55:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:45817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f35YY-00062r-QR for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:55:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f35YX-00015r-L5 for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:55:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f35YU-0005y9-HP for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:55:53 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:39113 helo=homiemail-a11.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f35YU-0005wi-AK for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:55:50 -0400 Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id F1BBF314C069 for ; Mon, 2 Apr 2018 12:55:47 -0700 (PDT) Received: from localhost.linkov.net (m91-129-105-236.cust.tele2.ee [91.129.105.236]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPSA id 52285314C066 for ; Mon, 2 Apr 2018 12:55:47 -0700 (PDT) From: Juri Linkov Organization: LINKOV.NET Date: Mon, 02 Apr 2018 22:48:38 +0300 Message-ID: <87in99jvg9.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=desktop-shell-mode.patch 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))) --=-=-=-- From unknown Tue Jun 17 22:27:24 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Juri Linkov Subject: bug#31028: closed (Re: bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable) Message-ID: References: <87woxmbt2g.fsf@mail.linkov.net> <87in99jvg9.fsf@mail.linkov.net> X-Gnu-PR-Message: they-closed 31028 X-Gnu-PR-Package: emacs Reply-To: 31028@debbugs.gnu.org Date: Wed, 04 Apr 2018 20:45:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1522874702-10543-1" This is a multi-part message in MIME format... ------------=_1522874702-10543-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #31028: 27.0.50; Saving shell buffers to a file makes the desktop file unre= adable 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@debbugs.gnu.org. --=20 31028: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D31028 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1522874702-10543-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 31028-done) by debbugs.gnu.org; 4 Apr 2018 20:44:28 +0000 Received: from localhost ([127.0.0.1]:38673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3pGe-0002j9-HL for submit@debbugs.gnu.org; Wed, 04 Apr 2018 16:44:28 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:37294 helo=homiemail-a19.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3pGc-0002j1-SR for 31028-done@debbugs.gnu.org; Wed, 04 Apr 2018 16:44:27 -0400 Received: from homiemail-a19.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTP id E870660406B for <31028-done@debbugs.gnu.org>; Wed, 4 Apr 2018 13:44:25 -0700 (PDT) Received: from localhost.linkov.net (m91-129-105-236.cust.tele2.ee [91.129.105.236]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTPSA id 476CB604069 for <31028-done@debbugs.gnu.org>; Wed, 4 Apr 2018 13:44:25 -0700 (PDT) From: Juri Linkov To: 31028-done@debbugs.gnu.org Subject: Re: bug#31028: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable Organization: LINKOV.NET References: <87in99jvg9.fsf@mail.linkov.net> Date: Wed, 04 Apr 2018 23:44:07 +0300 In-Reply-To: <87in99jvg9.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 02 Apr 2018 22:48:38 +0300") Message-ID: <87woxmbt2g.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31028-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > 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. ------------=_1522874702-10543-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Apr 2018 19:56:03 +0000 Received: from localhost ([127.0.0.1]:35431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f35Yh-0003n1-9Y for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:56:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f35Yf-0003mM-9E for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:56:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f35YY-000634-U0 for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:55:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:45817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f35YY-00062r-QR for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:55:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f35YX-00015r-L5 for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:55:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f35YU-0005y9-HP for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:55:53 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:39113 helo=homiemail-a11.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f35YU-0005wi-AK for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:55:50 -0400 Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id F1BBF314C069 for ; Mon, 2 Apr 2018 12:55:47 -0700 (PDT) Received: from localhost.linkov.net (m91-129-105-236.cust.tele2.ee [91.129.105.236]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPSA id 52285314C066 for ; Mon, 2 Apr 2018 12:55:47 -0700 (PDT) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 27.0.50; Saving shell buffers to a file makes the desktop file unreadable Organization: LINKOV.NET Date: Mon, 02 Apr 2018 22:48:38 +0300 Message-ID: <87in99jvg9.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=desktop-shell-mode.patch 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))) --=-=-=-- ------------=_1522874702-10543-1--