From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Tino Calancha <tino.calancha@gmail.com>
Newsgroups: gmane.emacs.bugs
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
Message-ID: <87lgx2b9we.fsf@gmail.com>
References: <alpine.DEB.2.20.1611021421040.3905@calancha-pc>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: blaine.gmane.org 1478072920 22860 195.159.176.226 (2 Nov 2016 07:48:40 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 2 Nov 2016 07:48:40 +0000 (UTC)
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
To: 24855@debbugs.gnu.org
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 02 08:48:35 2016
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1c1qHL-0002eB-I3
	for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 08:48:11 +0100
Original-Received: from localhost ([::1]:53187 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1c1qHO-0003gQ-45
	for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 03:48:14 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47003)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1c1qHG-0003gF-16
	for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 03:48:07 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1c1qHC-000866-U5
	for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 03:48:06 -0400
Original-Received: from debbugs.gnu.org ([208.118.235.43]:52552)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1c1qHC-000862-PK
	for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 03:48:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1c1qHC-0001r6-Fm
	for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2016 03:48:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Tino Calancha <tino.calancha@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 02 Nov 2016 07:48:02 +0000
Resent-Message-ID: <handler.24855.B24855.14780728777122@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 24855
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
Original-Received: via spool by 24855-submit@debbugs.gnu.org id=B24855.14780728777122
	(code B ref 24855); Wed, 02 Nov 2016 07:48:02 +0000
Original-Received: (at 24855) by debbugs.gnu.org; 2 Nov 2016 07:47:57 +0000
Original-Received: from localhost ([127.0.0.1]:39718 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1c1qH7-0001qn-Lk
	for submit@debbugs.gnu.org; Wed, 02 Nov 2016 03:47:57 -0400
Original-Received: from mail-pf0-f193.google.com ([209.85.192.193]:35112)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <tino.calancha@gmail.com>) id 1c1qH5-0001qa-Vj
	for 24855@debbugs.gnu.org; Wed, 02 Nov 2016 03:47:56 -0400
Original-Received: by mail-pf0-f193.google.com with SMTP id i88so1025435pfk.2
	for <24855@debbugs.gnu.org>; Wed, 02 Nov 2016 00:47:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; 
	h=from:to:subject:in-reply-to:references:user-agent:date:message-id
	:mime-version; bh=U5pvbryelAi9skVICupjZFeMUEOE9eWsoyjF3RJB0ps=;
	b=aEh7+J+ClVvjx2g7yggr9qI+J20phJqb1Tu5qsiG6Nslp7izMv9DlX98Fh2T7XWUPe
	f3rL/kv5mgByQn//OVaa0jkLYQLZVv3u1bV2IRcpEB55qAqUSh6h7dGPhmCjNN2FCM3u
	MI/1XeQCv+rk21jEzT6mwVrMHLshlLZ3T5VJKD8LqR87oIEL/hPE3Zs6kchAhlidcfQe
	I2wHJw+DUJttTRgEuBFcCqQDchN0xHeuP+42UpdrN4Rt4M01HG06Boun+Bxzzqmo0Jjf
	XXgKbkYwnVRmITOH5/zBQmfKJXhKNTuRkAlnid+GSOicVHvO2aYlINg1NqQoTtGPoYKD
	ih8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:to:subject:in-reply-to:references
	:user-agent:date:message-id:mime-version;
	bh=U5pvbryelAi9skVICupjZFeMUEOE9eWsoyjF3RJB0ps=;
	b=OUGHylUPKQZft09h6E7ad7zBtd0nzM3KvbRuMEaU7nP9GTeNTw7QKEK8DiYbDk+Jqw
	AJDp/LXqPJpp4gec7p/5jWjXiLYRLJvTddI3KmOd/Vy5shFzwjkiDIzFp4fQYvlmiKK3
	DpRuvoWjnJybCeMb2T7CnjBKtUtgk8EKI/R3bK/z6innAv3MSYX3sci5k/Z70UIQC1yK
	Iw8O0+boBdn5HpYr0JELTN3jJ0gdz0Ec2kA3KSnjZJpXDapYQchSC5ZGSw85CzqKIJ76
	FyYVNi0bc5ahkAiXS40XfIiJXW3qmbkDwFzPIIOjFJzgCie/JCoylVepz0jkUo/xIYuF
	liRw==
X-Gm-Message-State: ABUngveETYLfS7bc5L0YzAVqSN5ax0JBUVGpgtCnKYfDnOnozQRpucT+XYrviMkm6EteWQ==
X-Received: by 10.98.31.154 with SMTP id l26mr4338682pfj.87.1478072869797;
	Wed, 02 Nov 2016 00:47:49 -0700 (PDT)
Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57])
	by smtp.gmail.com with ESMTPSA id
	ak3sm2107359pad.19.2016.11.02.00.47.48 for <24855@debbugs.gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
	Wed, 02 Nov 2016 00:47:49 -0700 (PDT)
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)")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 208.118.235.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
	the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs/>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
	<bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:125261
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/125261>


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