From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: eval-print-last-sexp: "Selecting deleted buffer" error when the current buffer is killed evaluating the expression Date: Fri, 30 Jul 2021 08:58:34 +0300 Message-ID: <831r7gs5px.fsf@gnu.org> References: <20210730005551.5c77f879@pineapple> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2412"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Matthew White Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 30 07:59:26 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m9LYL-0000Qs-UY for ged-emacs-devel@m.gmane-mx.org; Fri, 30 Jul 2021 07:59:25 +0200 Original-Received: from localhost ([::1]:60348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9LYK-0000Nx-DD for ged-emacs-devel@m.gmane-mx.org; Fri, 30 Jul 2021 01:59:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9LXp-00087C-9Z for emacs-devel@gnu.org; Fri, 30 Jul 2021 01:58:53 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33152) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9LXn-0001hu-SR; Fri, 30 Jul 2021 01:58:51 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2831 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9LXn-0005MP-GL; Fri, 30 Jul 2021 01:58:51 -0400 In-Reply-To: <20210730005551.5c77f879@pineapple> (message from Matthew White on Fri, 30 Jul 2021 00:55:51 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271823 Archived-At: > Date: Fri, 30 Jul 2021 00:55:51 +0200 > From: Matthew White > > I tumbled on the error in the subject, "Selecting deleted buffer", > evaluating the following line in the "*scratch*" buffer with C-j: > > (kill-buffer (current-buffer)) > > When the other buffer isn't read-only, suppose "*foo*" is selected > after killing the current buffer "*scratch*", the error "Selecting > deleted buffer" appears into the echo area and the return value of > the evaluation is printed into the other buffer "*foo*". > > If the other buffer is "*Messages*", which is read-only, the error > "Buffer is read-only: #" will appear instead. > > I'd like to discuss the possibility to enforce printing the output > either to the initial current buffer when eval-print-last-sexp has > been called, or to the echo area when the prefix '-' is given. If > the initial current buffer (aka standard-output) is killed, during > the evaluation of the expression, we fall back to the echo area as > the output medium. Could you please tell what are the real-life situations where this problem happens and causes trouble? Killing the current buffer this way is unusual, so why isn't what we have now sufficient? You tried to insert something into a killed buffer, Emacs told you it cannot do that; why is that a problem? IME, trying to "fix" such obscure problems causes problems of its own that we then get to rectify for several releases in the future, so the net gains are very small if there are any.