unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 24855@debbugs.gnu.org
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	[thread overview]
Message-ID: <87lgx2b9we.fsf@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1611021421040.3905@calancha-pc> (Tino Calancha's message of "Wed, 2 Nov 2016 14:21:46 +0900 (JST)")


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 ()
   (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..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)
-- 
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





  reply	other threads:[~2016-11-02  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  5:21 bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space Tino Calancha
2016-11-02  7:47 ` Tino Calancha [this message]
2016-11-02  8:52   ` Andreas Schwab
2016-11-02  9:50     ` Tino Calancha
2016-11-22  6:57 ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgx2b9we.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=24855@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).