Subject: bug#79152: closed (Re: bug#79152: [PATCH] ibuffer-update-title-and-summary: Fix out of range error)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 02 Aug 2025 13:28:02 +0000

Your bug report

#79152: [PATCH] ibuffer-update-title-and-summary: Fix out of range error

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 [email-masked].

-- 
79152: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79152
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79152: [PATCH] ibuffer-update-title-and-summary: Fix out of range error
From: Eli Zaretskii <[email-masked]>
To: Daniel Mendler <[email-masked]>
Cc: [email-masked]
Date: Sat, 02 Aug 2025 16:27:18 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Cc: Eli Zaretskii <[email-masked]>
> From: Daniel Mendler <[email-masked]>
> Date: Sat, 02 Aug 2025 13:15:20 +0200
> 
> This patch fixes an error in Ibuffer when the buffer list is empty and
> `ibuffer-use-header-line' is set to the value `title', which has been
> introduced recently.

Thanks, installed on master and closing the bug.

P.S. There's no need to CC me on bug reports, as I'm reading the bug
list all the time.

Subject: [PATCH] ibuffer-update-title-and-summary: Fix out of range error
From: Daniel Mendler <[email-masked]>
To: [email-masked]
Date: Sat, 02 Aug 2025 13:15:20 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

This patch fixes an error in Ibuffer when the buffer list is empty and
`ibuffer-use-header-line' is set to the value `title', which has been
introduced recently.

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.4) of 2025-07-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --prefix=$HOME/.local/share/emacs
 --without-compress-install --with-tree-sitter --with-native-compilation
 --with-dbus --without-selinux --without-threads --disable-gc-mark-trace
 --without-gsettings --without-gpm --with-cairo --with-cairo-xcb
 --with-xinput2 --with-x-toolkit=gtk3 --without-toolkit-scroll-bars
 'CFLAGS=-O3 -mtune=native -march=native''

>From 326c4f6d46ae40fdb2ff77d43eb049cd0020e1b2 Mon Sep 17 00:00:00 2001
From: Daniel Mendler <[email-masked]>
Date: Sat, 2 Aug 2025 13:07:58 +0200
Subject: [PATCH] ibuffer-update-title-and-summary: Fix out of range error

When `ibuffer-use-header-line' is set to `title' and the buffer list
contains no buffers due to a filter, `ibuffer-update-title-and-summary'
errors with an "Args out of range: 0, 0" error.

* lisp/ibuffer.el (ibuffer-update-title-and-summary): Check if buffer is
empty to prevent out of range error.
---
 lisp/ibuffer.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 95deb2db478..ae7e8dd4117 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -2136,7 +2136,8 @@ ibuffer-update-title-and-summary
        `(ibuffer-title t font-lock-face ,ibuffer-title-face)))
     ;; Now, insert the summary columns.
     (goto-char (point-max))
-    (if (get-text-property (1- (point-max)) 'ibuffer-summary)
+    (if (and (> (point-max) (point-min))
+             (get-text-property (1- (point-max)) 'ibuffer-summary))
 	(delete-region (previous-single-property-change
 			(point-max) 'ibuffer-summary)
 		       (point-max)))
-- 
2.47.2