Open ghost opened 11 years ago
It does not return nil here. Can you give me an example written in the form of a breaking ERT test?
Re: ERT. If you can provide some guidance...
(ert-deftest gnus-harvest/mff-not-working ()
(with-temp-buffer
... insert message headers ...
(message-mode)
(assert (string= (message-fetch-field HEADER) VALUE)))
Run with M-x ert
. This should prove the failure on your side, and then I can add this test to the sources.
(ert-deftest gnus-harvest/mff-not-working ()
(with-temp-buffer
(message-mode)
(insert-string "
From: iTunes Store do_not_reply@itunes.com
Subject: Your receipt No.849348590212531946
To: andrew.iain.mcdermott@gmail.com
Date: Mon, 20 May 2013 07:07:20 +0000 (GMT) (1 week, 1 day, 14 hours ago)
Message-ID: 216235506.7265841369033640784.JavaMail.cboxp@loclac.apple.com")
(assert (string= (message-fetch-field "to") "andrew.iain.mcdermott@gmail.com"))))
This doesn't seem to fail, yet when I step through (gnus-harvest-addresses) the difference seem to be that nothing matches "to", "from", etc.
It seems that in emacs 24 the current buffer is not the article buffer when (gnus-harvest-addresses)
is run.
I instrumented (g-h-a)
with:
(message "current-buffer=%s" (current-buffer)) (backtrace)
And running under emacs 24 I see:
current-buffer=*Summary nnimap+LOCAL:INBOX*
backtrace()
gnus-harvest-addresses()
run-hooks(gnus-article-prepare-hook)
apply(run-hooks gnus-article-prepare-hook)
gnus-run-hooks(gnus-article-prepare-hook)
gnus-article-prepare(4484 nil)
gnus-summary-display-article(4484)
gnus-summary-next-page(nil)
call-interactively(gnus-summary-next-page nil nil)
whereas emacs 23 shows:
current-buffer=*Article*
backtrace()
gnus-harvest-addresses()
run-hooks(gnus-article-prepare-hook)
apply(run-hooks gnus-article-prepare-hook)
gnus-run-hooks(gnus-article-prepare-hook)
gnus-article-prepare-display()
gnus-article-prepare(4490 nil)
gnus-summary-display-article(4490)
gnus-summary-next-page(nil)
call-interactively(gnus-summary-next-page nil nil)
And in either version if I evaluate (mail-fetch-field "to") in the article buffer then I get a non-nil value so it seems, to me at least, that it would work if in emacs 24 the article buffer was current.
Working through this a little more I see that:
$ /usr/local/emacs-24.2/bin/emacs --version
GNU Emacs 24.2.1
works OK, but:
$ /usr/local/emacs-24.3/bin/emacs --version
GNU Emacs 24.3.1
doesn't.
I ran a git bisect on the emacs tree and this is where it started to fail:
git bisect start
# bad: [3a1ce0685f66f5fb162b07f6bf4a1d8e1ec75c06] Add 24.3 release to ChangeLogs
git bisect bad 3a1ce0685f66f5fb162b07f6bf4a1d8e1ec75c06
# good: [efd2cb93e8db6256047b0cb8f1cc301ed2d0581a] Update release logs
git bisect good efd2cb93e8db6256047b0cb8f1cc301ed2d0581a
# good: [05831868ca73b894678320d374098bf6fe176cce] Fix fallout from revision 109354 that introduced WVAR.
git bisect good 05831868ca73b894678320d374098bf6fe176cce
# bad: [7899e588e1e29a2c7b016f9ba996e761258fb7cb] * profiler.c (handle_profiler_signal): Fix a malloc race
git bisect bad 7899e588e1e29a2c7b016f9ba996e761258fb7cb
# bad: [7c79c3bf14b9d4d38fbfb18e875b1ed2600dfac6] Give more-useful info on a fatal error (Bug#12328).
git bisect bad 7c79c3bf14b9d4d38fbfb18e875b1ed2600dfac6
# good: [a60ed6f929d537ccb399fac9e5389755028ee01c] Fix bug #12196 with incorrect memory allocations fo region-cache.
git bisect good a60ed6f929d537ccb399fac9e5389755028ee01c
# bad: [53b86b35c462f31df28964bce9db1f8c77a6854d] * buffer.c, buffer.h: Use bool for boolean.
git bisect bad 53b86b35c462f31df28964bce9db1f8c77a6854d
# bad: [bb71e80d2559e2e255a62aa8984faa476dd3c3b0] Inline setter functions for Lisp_Objects slots of struct specbinding. * eval.c (set_specpdl_symbol, set_specpdl_old_value): New functions. Adjust users.
git bisect bad bb71e80d2559e2e255a62aa8984faa476dd3c3b0
# good: [ecfc5e4ac8d022075f6b1224a36bd266426cb086] * lisp.h (set_char_table_extras): Rename from char_table_set_extras.
git bisect good ecfc5e4ac8d022075f6b1224a36bd266426cb086
# good: [c7b8405bb82e10c70679fc3e583e3720723cbd40] * data.c (set_internal): Don't use set_blv_found. (Fkill_local_variable): Likewise.
git bisect good c7b8405bb82e10c70679fc3e583e3720723cbd40
# good: [ac4e7a99830b13a3e026554f40351945bd476056] src/makefile.w32-in ($(BLD)/vm-limit.$(O)): Update dependencies.
git bisect good ac4e7a99830b13a3e026554f40351945bd476056
# good: [1e8ccb96236841b0642a84ee7dd23fcdd456d514] Inline getter and setter functions for per-buffer values. * buffer.h (per_buffer_default, set_per_buffer_default) (per_buffer_value, set_per_buffer_value): New functions. (PER_BUFFER_VALUE, PER_BUFFER_DEFAULT): Remove. * buffer.c, data.c: Adjust users.
git bisect good 1e8ccb96236841b0642a84ee7dd23fcdd456d514
# good: [36dd6197283e3d7598fcda07a6ee43ba9b3b52a6] Inline setter functions for hash table members. * lisp.h (set_hash_key, set_hash_value, set_hash_next) (set_hash_hash, set_hash_index): Rename with _slot suffix. (set_hash_key_and_value, set_hash_index, set_hash_next) (set_hash_hash): New functions. * charset.c, fns.c: Adjust users.
git bisect good 36dd6197283e3d7598fcda07a6ee43ba9b3b52a6
# bad: [878fab175267546ec027c623c171f4cf91efa95c] In select_window always make selected window's buffer current.
git bisect bad 878fab175267546ec027c623c171f4cf91efa95c
which is this commit:
commit 878fab175267546ec027c623c171f4cf91efa95c
Author: martin rudalics <rudalics@gmx.at>
Date: Mon Aug 20 11:28:39 2012 +0200
In select_window always make selected window's buffer current.
* window.c (select_window): Always make selected window's buffer
current.
I don't know enough of the internals of Emacs to know whether this is broken in emacs itself or whether it's the way gnus/gnus-harvest-addresses is driving the show.
Thanks, I'll take a look!
Hmm.. I think this may have to be routed over to the Gnus folks. Their documentation for gnus-article-prepare-hook
implies that my focus is in the article buffer when that hook is run, which gnus-harvest is depending on. I'd rather not try to have to hunt around for the article buffer by name...
I switched to Emacs 24 and noticed that I get no new addresses. Is this a known issue?
The difference seems to be that this function:
returns nil for emacs 24.
I was trying emacs-23.4.1 and 24.3.1.