Subject: Re: bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space

From: Tino Calancha <[email-masked]>
Date: Wed, 02 Nov 2016 18:50:20 +0900

Andreas Schwab <[email-masked]> writes:

> On Nov 02 2016, Tino Calancha <[email-masked]> wrote:
>
>> @@ -312,7 +315,7 @@ tabulated-list-print
>>  method which is faster if most entries haven't changed since the
>>  last print.  The only difference in outcome is that tags will not
>>  be removed from entries that haven't changed (see
>> -`tabulated-list-put-tag').  Don't use this immediately after
>> +(erase-buffer)`tabulated-list-put-tag').  Don't use this immediately after
>
> Paste accident?
Yes, thank you!  That happens when i have long nails.  Time to cut...
Here is the corrected patch:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>From da5331dbb415f0779e36b15cbe1c943ee00f8081 Mon Sep 17 00:00:00 2001
From: Tino Calancha <[email-masked]>
Date: Wed, 2 Nov 2016 18:43:44 +0900
Subject: [PATCH] Buffer-menu-no-header: Detect a fake header

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-no-header-p):
New predicate.
* lisp/buff-menu.el (Buffer-menu-no-header): Use it (Bug#24855).
---
 lisp/buff-menu.el                 | 2 +-
 lisp/emacs-lisp/tabulated-list.el | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 4742628..22f7abe 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -328,7 +328,7 @@ Buffer-menu-buffer
 (defun Buffer-menu-no-header ()
   (beginning-of-line)
   (if (or Buffer-menu-use-header-line
-	  (not (eq (char-after) ?C)))
+	  (tabulated-list-no-header-p (point)))
       t
     (ding)
     (forward-line 1)
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 00b029d..590bcbc 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -257,6 +257,9 @@ tabulated-list-print-fake-header
                     (make-overlay (point-min) (point))))
       (overlay-put tabulated-list--header-overlay 'face 'underline))))
 
+(defsubst tabulated-list-no-header-p (&optional pos)
+  (null (overlays-at (or pos (point-min)))))
+
 (defun tabulated-list-revert (&rest ignored)
   "The `revert-buffer-function' for `tabulated-list-mode'.
 It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'."
-- 
2.10.1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.5 (x86_64-pc-linux-gnu, GTK+ Version 3.22.2)
 of 2016-11-02 built on calancha-pc
Repository revision: 126c879df42f741fe486236aea538290a8c2ed64