From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#64230: 30.0.50; Ibuffer reports 1 file too many with ibuffer-auto-mode enabled Date: Mon, 11 Sep 2023 16:18:43 +0200 Message-ID: <87cyyox070.fsf@gmx.net> References: <874jmzo0wv.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29128"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64230@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 11 16:19:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qfhkw-0007LO-9M for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Sep 2023 16:19:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfhkg-0000Jk-U0; Mon, 11 Sep 2023 10:18:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfhkg-0000JU-9b for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 10:18:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfhkg-0001fv-1w for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 10:18:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfhkk-0006Tr-2G for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 10:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Sep 2023 14:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64230 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64230-submit@debbugs.gnu.org id=B64230.169444193924902 (code B ref 64230); Mon, 11 Sep 2023 14:19:02 +0000 Original-Received: (at 64230) by debbugs.gnu.org; 11 Sep 2023 14:18:59 +0000 Original-Received: from localhost ([127.0.0.1]:54238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfhkg-0006Ta-Sy for submit@debbugs.gnu.org; Mon, 11 Sep 2023 10:18:59 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:39041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfhkd-0006TK-6G for 64230@debbugs.gnu.org; Mon, 11 Sep 2023 10:18:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1694441924; x=1695046724; i=stephen.berman@gmx.net; bh=ICrvlqhYeDty819qNpsAK+RlsT/rRoLKKS5abUGTqHY=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=CSAGOzYbXnqQ9BtcnIv2cEJ7g4ReZ8RglXbQA2iHCjGRwatgyssuvVVebCqYJAfpukGBHst o6oO+X2+gac3h3b+6C0Mx+GP+C6TGHpNq42Z7EBtxx30NQJZ0o1tkgtmLs8RZy9k3Dj6XRZ2V /Ay1mHcuJMR0nmua95Tko31UBaT/kEsXpXQL8SoMHUmff7tkH7/eTzUa57mPs8iv9KMHabA2d 859TZEYzUqQH7erzSGJWPo1EqCTcxfcYKbehoMYtdjpSItz+iTAMz13lrgohiv2czt6P4k21c yVasxqkpMQtoeHUnMpXZuSNy5gX4XpSz/FqxLjr2iB97ICBXylpg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs2 ([94.134.196.156]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M3UZG-1qf9mb48vq-000fpa; Mon, 11 Sep 2023 16:18:44 +0200 In-Reply-To: (Stefan Kangas's message of "Sun, 10 Sep 2023 07:11:07 -0700") X-Provags-ID: V03:K1:2TuUnXK9kRKJ1wmZ+sGwRqYqlOd1gHjwW1qosdOU9zA//INe8LT 1Z23ILhdveUUv9mEUscLp6mg6/gLBLfqEfEnRrDoHnJPTTinFn7uNpHTcTYKcRZCs6VY7pg 21oPiucxbWXSqKUXvl6Bz0iTOyb4vFPJzHyi6hRKlUWJqb7xEYzSl0qIG1/x1QUn6p4PWDQ gkQ4y2JPgUZ1+hN/riXgg== UI-OutboundReport: notjunk:1;M01:P0:So3JstmvTLg=;7gHx1e4Tw4C1wq/RkXz7CTHnU+i d/6pv2OEiCp+zFkEky8yauK2CAf57ON6GLJsRQKXdJotgAdHUEFPnBMG/Ha68KusdBEdqMXb4 mvGiaRbr5y0sRVUW7SzdZ80LXdXKz5oVCd9a00afAnbE3U2jveFZRJ2LFkxM4LK6UeNvIfWOq fvJuQx7zeSgdCRwVRaRe9r3tJbJh4P/h04s+1RMpB1vPbpQhsC/z/EWWeddVOt7jsX026VKbe l44iIP5A3yC1ctIcjj+N9vpp7sSLLgy3pGhjE9onuHOHqCrdc1ftLIiRppef01QsQWFPiuNEg 89b4PUykQ85ckRFswqIC0fmi2Iy5UOj+Gk4uODe2Txig9ivmJg6/4e51Qb/0mtjhx/nqL35Lg veSQpeQi6o3MmiHtfz0FVSkdAIeD/fujbweqsASn2/JUm0JXCXTwZMrb6TNDxh5E2GvXqvsFb zkBhvzcAl1vcFc6uRtwOKEf3cPaywrDSkWJqULRI/BIpx1x4aursiJ5DlKBMCM39GWdEBmjgH uI/vBKzfMAlC8IQzIk2nRQLeV6OJQ+kJEP0g1m5z2dp3CaFM34n5IgGEPzkNdQecbMNv7dKOQ e77jv0+vwvSP8ocJI2DAnzO9JPP4K1B/s4Fzsbx8BoW0TQDOnU2rv5NuoBUwD2m8iPBmNsvac QHRG9kYlza0nPTXEv48PVs9X9emg9/E2LfEbQOYzcvInFio/fn4DLfXQLF6i8vEojD1JyYKYd E/cHOLiXtsnuw3Q7acW/iCeU7i+Hj5Pv9x0yW+c7kxe/uX/Z6iHp+Wp2q0Y59m2WzbjxIIOW X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270046 Archived-At: On Sun, 10 Sep 2023 07:11:07 -0700 Stefan Kangas wrote: > Stephen Berman writes: > >> 0. emacs -Q >> 1. Type `M-x' and then TAB to pop up the *Completions* buffer, then type >> `C-g'. >> 2. Type `M-x ibuffer'. >> 3. Type `d' on the lines for the buffers *scratch* and *Completions* to >> flag them for deletion. >> 4. Type `C-c C-a' to enable ibuffer-auto-mode. >> 5. Type `x' and at the prompt "Really kill 2 buffers? (y or n)" type `y'. >> => The *Ibuffer* lines for *scratch* and *Completions* are deleted and >> the echo area displays this message: "Operation finished; killed 3 >> buffers". >> >> If you change this recipe by omitting step 4, then after the buffer >> lines are deleted the message displayed is "Operation finished; killed 2 >> buffers". >> >> The unexpected message with ibuffer-auto-mode enabled is displayed in >> Emacs 27-30 but not in Emacs 26. With Emacs 27+, on typing `x' at step >> 5, the buffer *Ibuffer confirmation* pops up and a line for this buffer >> immediately appears in the *Ibuffer* display, and this is counted by the >> function `ibuffer-map-lines', and on typing `y' not only are the two >> flagged buffers deleted, but also *Ibuffer confirmation*, hence "killed >> 3 buffers". In contrast, in Emacs 26, the popped up buffer *Ibuffer >> confirmation* does not get added to the *Ibuffer* display and thus is >> not counted by `ibuffer-map-lines'. >> >> AFAICT, this difference is not due to any ibuffer code changes after >> Emacs 26; rather, there appears to be a timing difference with respect >> to when Emacs updates the *Ibuffer* display: when I instrument >> `ibuffer-update' for Edebug and then type `x' (step 5 above), what >> happens in Emacs 26 is that I can confirm with `y', then the flagged >> lines are deleted, and only then does Edebug stop the execution so I can >> step into `ibuffer-update'; while in Emacs 27+, as soon as I type `x', >> Edebug stops execution, i.e., before the flagged lines are deleted. >> >> `ibuffer-update' is called in `ibuffer-auto-update-changed', which is >> added to post-command-hook in `ibuffer-auto-mode'. So it seems that in >> Emacs 26 post-command-hook runs or takes effect later than in Emacs 27+. >> Whether this is really the case, and if so, what change it is due to, I >> haven't determined, and I don't know how restore the Emacs 26 execution >> order (or if that's even desirable). But even if the difference is due >> to something else, the message displayed in Emacs 27+ after the deletion >> of the *Ibuffer* lines is at least misleading, since it clearly is meant >> to refer only to the flagged lines, as in Emacs 26. >> >> In lieu of a real fix, since it is, AFAICS, only the transient buffer >> *Ibuffer confirmation* that results in the problematic message, a >> workaround is simply to decrement the line count by one when >> ibuffer-auto-mode is enabled, as in the the attached patch (which also >> takes the opportunity to wrap an overlong line in `ibuffer-map-lines'). > > Your analysis and patch makes sense to me. Please install, but add a > brief comment explaining why we do that decrement there. Done, and pushed as commit ca95e45f7e8. Thanks. Steve Berman