[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts wi

From: Tino Calancha
Subject: bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space
Date: Wed, 02 Nov 2016 16:47:45 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Or we might add a new predicate `tabulated-list-no-header-p':

>From 91c45beea1ea8bfc4931f03ef391ffbe15e99c64 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Wed, 2 Nov 2016 16:38:23 +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 | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

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 ()
   (if (or Buffer-menu-use-header-line
-         (not (eq (char-after) ?C)))
+         (tabulated-list-no-header-p (point)))
     (forward-line 1)
diff --git a/lisp/emacs-lisp/tabulated-list.el 
index 00b029d..415cd24 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'."
@@ -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
 changing `tabulated-list-sort-key'."
   (let ((inhibit-read-only t)
        (entries (if (functionp tabulated-list-entries)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]