all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: bbdb-user@nongnu.org, 54423@debbugs.gnu.org, ding@gnus.org
Subject: 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__27863.9262820192$1647907966$gmane$org@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:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 15:13 bug#54423: 29.0.50; gnus-fetch-original-field returns nil in digest Sam Steingold
2022-03-17 10:59 ` Lars Ingebrigtsen
2022-03-17 12:06   ` Lars Ingebrigtsen
2022-03-17 15:24     ` Sam Steingold
2022-03-17 15:35       ` Lars Ingebrigtsen
2022-03-22  0:04         ` Sam Steingold [this message]
     [not found]         ` <lzfsnaj1i2.fsf@3c22fb11fdab.ant.amazon.com>
2022-03-22 16:49           ` Roland Winkler
2022-03-17 15:29   ` Sam Steingold
     [not found]   ` <lzilsctx5r.fsf@3c22fb11fdab.ant.amazon.com>
2022-03-17 19:40     ` Roland Winkler
     [not found]     ` <874k3w2wqf.fsf@gnu.org>
2022-03-17 19:43       ` Lars Ingebrigtsen
2022-03-17 19:51         ` Roland Winkler
2022-03-17 20:09         ` Sam Steingold
2022-03-17 20:24           ` Lars Ingebrigtsen
2022-03-21 20:25   ` 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__27863.9262820192$1647907966$gmane$org@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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.