unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space
@ 2016-11-02  5:21 Tino Calancha
  2016-11-02  7:47 ` Tino Calancha
  2016-11-22  6:57 ` Tino Calancha
  0 siblings, 2 replies; 5+ messages in thread
From: Tino Calancha @ 2016-11-02  5:21 UTC (permalink / raw)
  To: 24855


emacs -r -Q -eval "(setq Buffer-menu-use-header-line nil)"
C-x C-b C-x o
M-: (Buffer-menu-no-header) RET
=> t


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 7385a0952923cc3ec435fe9097cd5c81da4c59eb Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Wed, 2 Nov 2016 14:14:58 +0900
Subject: [PATCH] Buffer-menu-no-header: Detect a fake header

* lisp/buff-menu.el (Buffer-menu-no-header): Match fake
headers starting with a white space (Bug#24855).
---
  lisp/buff-menu.el | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 4742628..41bcfab 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)))
+	  (not (looking-at-p "^ ?C")))
        t
      (ding)
      (forward-line 1)
-- 
2.10.1

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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space
  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
  2016-11-02  8:52   ` Andreas Schwab
  2016-11-22  6:57 ` Tino Calancha
  1 sibling, 1 reply; 5+ messages in thread
From: Tino Calancha @ 2016-11-02  7:47 UTC (permalink / raw)
  To: 24855


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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space
  2016-11-02  7:47 ` Tino Calancha
@ 2016-11-02  8:52   ` Andreas Schwab
  2016-11-02  9:50     ` Tino Calancha
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2016-11-02  8:52 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 24855

On Nov 02 2016, Tino Calancha <tino.calancha@gmail.com> 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?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space
  2016-11-02  8:52   ` Andreas Schwab
@ 2016-11-02  9:50     ` Tino Calancha
  0 siblings, 0 replies; 5+ messages in thread
From: Tino Calancha @ 2016-11-02  9:50 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 24855, Tino Calancha

Andreas Schwab <schwab@suse.de> writes:

> On Nov 02 2016, Tino Calancha <tino.calancha@gmail.com> 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 <tino.calancha@gmail.com>
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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#24855: 26.0.50; Buffer-menu-no-header fails if fake header starts with white space
  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
@ 2016-11-22  6:57 ` Tino Calancha
  1 sibling, 0 replies; 5+ messages in thread
From: Tino Calancha @ 2016-11-22  6:57 UTC (permalink / raw)
  To: 24855-done

Tino Calancha <tino.calancha@gmail.com> writes:

> emacs -r -Q -eval "(setq Buffer-menu-use-header-line nil)"
> C-x C-b C-x o
> M-: (Buffer-menu-no-header) RET
> => t
Pushed fix to master branch as commit: 4940e0f





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-22  6:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2016-11-02  8:52   ` Andreas Schwab
2016-11-02  9:50     ` Tino Calancha
2016-11-22  6:57 ` Tino Calancha

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