Gnus development mailing list
 help / color / mirror / Atom feed
From: Sam Steingold <sds@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 54423@debbugs.gnu.org, ding@gnus.org, bbdb-user@nongnu.org
Subject: Re: bug#54423: 29.0.50; gnus-fetch-original-field returns nil in digest
Date: Mon, 21 Mar 2022 20:04:53 -0400	[thread overview]
Message-ID: <lzfsnaj1i2.fsf@3c22fb11fdab.ant.amazon.com> (raw)
In-Reply-To: <87k0cssiaw.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 17 Mar 2022 16:35:51 +0100")

Context (see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54423):
`bbdb-message-header' calls `gnus-fetch-original-field' which,
for a digest ("nndoc") group, returns nil for every header.

The root of the problem is that `gnus-fetch-original-field' relies on
`gnus-original-article-buffer' which is buffer-local:

--8<---------------cut here---------------start------------->8---
gnus-original-article-buffer is a variable defined in ‘gnus.el’.

Its value is
" *Original Article nndoc:gmane.comp.security.risks-1023*"
Local in buffer *Summary nndoc:gmane.comp.security.risks-1023*; global value is the same.
--8<---------------cut here---------------end--------------->8---

(buffer " *Original Article nndoc:gmane.comp.security.risks-1023*" is _empty_!)
and at the _same_ time (no gnus command executed, just a buffer switch):

--8<---------------cut here---------------start------------->8---
gnus-original-article-buffer is a variable defined in ‘gnus.el’.

Its value is " *Original Article gmane.comp.security.risks*"
Local in buffer *Summary gmane.comp.security.risks*; global value is the same.
--8<---------------cut here---------------end--------------->8---

Lars suggested that I use this:

--8<---------------cut here---------------start------------->8---
(gnus-info-params (gnus-get-info gnus-newsgroup-name))
--8<---------------cut here---------------end--------------->8---

and it appears that the following works:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/bbdb-mua.el b/lisp/bbdb-mua.el
index f9d141d..ab3863c 100644
--- a/lisp/bbdb-mua.el
+++ b/lisp/bbdb-mua.el
@@ -111,7 +111,17 @@ MIME encoded headers are decoded.  Return nil if HEADER does not exist."
                      ;; `bbdb-select-message' does not get fooled by an apparent
                      ;; absence of some headers.
                      ;; See http://permalink.gmane.org/gmane.emacs.gnus.general/78741
-                     (eq mua 'gnus) (gnus-fetch-original-field header))
+                     (eq mua 'gnus)
+                     (or (gnus-fetch-original-field header)
+                         ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54423
+                         ;; 'gnus-fetch-original-field' returns nil in nndoc groups
+                         ;; (digests) because the 'qgnus-original-article-buffer' is
+                         ;; empty for the nndoc summary but not for the parent summary.
+                         (and-let* ((i (gnus-get-info gnus-newsgroup-name))
+                                    (p (gnus-info-params i))
+                                    (parent-summary-buffer (cadr (assq 'quit-config p))))
+                           (with-current-buffer parent-summary-buffer
+                             (gnus-fetch-original-field header)))))
                     ((eq mua 'vm) (bbdb/vm-header header))
                     ((eq mua 'rmail)
                      (with-current-buffer rmail-buffer
--8<---------------cut here---------------end--------------->8---

`quit-config' contains the parent summary buffer object.
I would rather use that directly that construct the string
" *Original Article gmane.comp.security.risks*"
(especially since the relevant logic in `gnus-article-setup-buffer' is
moderately convoluted).

The question is whether this is TRT or there is a better way.

Thanks to Lars for his patience, and to everyone else for possible
suggestion.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://honestreporting.com https://camera.org http://think-israel.org
Money does not bother me at all.  In fact, it calms me down.


       reply	other threads:[~2022-03-22  0:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <lzr172szfa.fsf@3c22fb11fdab.ant.amazon.com>
     [not found] ` <87ee30vo80.fsf@gnus.org>
     [not found]   ` <87cziku6kv.fsf@gnus.org>
     [not found]     ` <lzmthotxdi.fsf@3c22fb11fdab.ant.amazon.com>
     [not found]       ` <87k0cssiaw.fsf@gnus.org>
2022-03-22  0:04         ` Sam Steingold [this message]
2022-03-22 16:49           ` Roland Winkler
     [not found]             ` <lzbkxxj4nq.fsf@3c22fb11fdab.ant.amazon.com>
2022-03-22 17:27               ` Roland Winkler
2022-03-22 18:06                 ` Sam Steingold

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

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

  git send-email \
    --in-reply-to=lzfsnaj1i2.fsf@3c22fb11fdab.ant.amazon.com \
    --to=sds@gnu.org \
    --cc=54423@debbugs.gnu.org \
    --cc=bbdb-user@nongnu.org \
    --cc=ding@gnus.org \
    --cc=larsi@gnus.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.
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 NNTP newsgroup(s).