bbdb-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#54423: 29.0.50; gnus-fetch-original-field returns nil in digest


From: Sam Steingold
Subject: Re: bug#54423: 29.0.50; gnus-fetch-original-field returns nil in digest
Date: Mon, 21 Mar 2022 20:04:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]