unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27084: 26.0.50; gnus-summary-toggle-header can fail to hide headers
@ 2017-05-26 12:51 Stephen Berman
  2017-07-20  7:17 ` Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Berman @ 2017-05-26 12:51 UTC (permalink / raw)
  To: 27084

[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]

The command `gnus-summary-toggle-header' correctly shows all headers of
an article in an Emacs bug report ephemeral group, but incorrectly fails
to rehide the headers that are hidden by default.  To reproduce:

0. emacs -Q
1. C-h f gnus-re TAB (to load Gnus, making the next command available).
2. M-x gnus-read-ephemeral-emacs-bug-group RET 27008 RET (or any bug
   number).
3. SPC (to display the first article, which hides some headers).
4. t (invokes `gnus-summary-toggle-header', displaying all headers of
   the article).
5. Typing `t' again should now rehide the headers that were not shown in
   step 3, but
=> nothing happens, i.e., all headers remain visible.

The problem seems to be that after step 4, the first line of the
*Article* buffer contains a header like this:

From unknown Fri May 26 08:24:49 2017

and gnus-summary-toggle-header tests for hidden headers by looking for a
colon before the first space in that line; since the test fails, it
treats the headers as hidden, so it doesn't hide them again.

This problem also happens with other "foreign" Gnus groups; I didn't
test all types but I see it e.g. with directory groups (`G d' in the
Gnus *Group* buffer) and the Gnus help group (`G h').  If in all such
groups the first header line is like the above but the second header
line satisfies the test (it does in the cases I looked at, but I don't
know if that's always so), then the patch below is probably the simplest
fix.

In GNU Emacs 26.0.50 (build 24, x86_64-pc-linux-gnu, GTK+ Version 3.22.8)
 of 2017-05-24 built on rosalinde
Repository revision: bba9917299e3628e40462a762f2a14bb8df193f0
Windowing system distributor 'The X.Org Foundation', version 11.0.11901000



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-summary-toggle-header patch --]
[-- Type: text/x-patch, Size: 422 bytes --]

diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 9bdd0c66f5..819b56e531 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9776,6 +9776,7 @@ gnus-summary-toggle-header
     (with-current-buffer gnus-article-buffer
       (widen)
       (article-narrow-to-head)
+      (forward-line)
       (let* ((inhibit-read-only t)
 	     (inhibit-point-motion-hooks t)
 	     (hidden (if (numberp arg)

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

* bug#27084: 26.0.50; gnus-summary-toggle-header can fail to hide headers
  2017-05-26 12:51 bug#27084: 26.0.50; gnus-summary-toggle-header can fail to hide headers Stephen Berman
@ 2017-07-20  7:17 ` Katsumi Yamaoka
  2017-07-20  8:44   ` Stephen Berman
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2017-07-20  7:17 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 27084

On Fri, 26 May 2017 14:51:45 +0200, Stephen Berman wrote:
> The command `gnus-summary-toggle-header' correctly shows all headers of
> an article in an Emacs bug report ephemeral group, but incorrectly fails
> to rehide the headers that are hidden by default.  To reproduce:

Oops.  Sorry.  That's my fault:

2004-10-01  Katsumi Yamaoka  <yamaoka@jpl.org>

	* gnus-sum.el (gnus-summary-toggle-header): Make it work even if
	there's no visible header.

--- ngnus-0.2/lisp/gnus-sum.el	2004-04-25 18:01:33.000000000 +0000
+++ ngnus-0.3/lisp/gnus-sum.el	2005-03-03 18:00:15.000000000 +0000
@@ -8810,7 +8911,8 @@
 	     (inhibit-point-motion-hooks t)
 	     (hidden (if (numberp arg)
 			 (>= arg 0)
-		       (gnus-article-hidden-text-p 'headers)))
+		       (or (not (looking-at "[^ \t\n]+:"))
+			   (gnus-article-hidden-text-p 'headers))))
 	     s e)
 	(delete-region (point-min) (point-max))
 	(with-current-buffer gnus-original-article-buffer

An article that the change intended so as to make
`gnus-summary-toggle-header' work for was the one in which there
is no visible header that `gnus-visible-headers' specifies, like
this:

Delivered-To: foo
Received: from...
Received: from...
MIME-Version: 1.0

That is, it's broken, there is no From, To, Cc, etc. as usual.
Anyway I've fixed it by replacing (not (looking-at "[^ \t\n]+:"))
with (looking-at "\n?\\'") + a comment.

Regards,





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

* bug#27084: 26.0.50; gnus-summary-toggle-header can fail to hide headers
  2017-07-20  7:17 ` Katsumi Yamaoka
@ 2017-07-20  8:44   ` Stephen Berman
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Berman @ 2017-07-20  8:44 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 27084

On Thu, 20 Jul 2017 16:17:10 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote:

> On Fri, 26 May 2017 14:51:45 +0200, Stephen Berman wrote:
>> The command `gnus-summary-toggle-header' correctly shows all headers of
>> an article in an Emacs bug report ephemeral group, but incorrectly fails
>> to rehide the headers that are hidden by default.  To reproduce:
>
> Oops.  Sorry.  That's my fault:
[...]
> Anyway I've fixed it by replacing (not (looking-at "[^ \t\n]+:"))
> with (looking-at "\n?\\'") + a comment.

I confirm the bug is now fixed; thanks.

Steve Berman





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

end of thread, other threads:[~2017-07-20  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-26 12:51 bug#27084: 26.0.50; gnus-summary-toggle-header can fail to hide headers Stephen Berman
2017-07-20  7:17 ` Katsumi Yamaoka
2017-07-20  8:44   ` Stephen Berman

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