* nnir-summary-line-format doesn't work
@ 2020-06-06 9:21 Tassilo Horn
2020-06-06 20:10 ` Eric Abrahamsen
0 siblings, 1 reply; 4+ messages in thread
From: Tassilo Horn @ 2020-06-06 9:21 UTC (permalink / raw)
To: ding
Hi all,
it seems like `nnir-summary-line-format' doesn't work in the current
Emacs master (and probably hasn't worked for ages). It gets set as
`gnus-summary-line-format' in `nnir-mode' which is called in
`gnus-summary-prepared-hook'. However, at that point, the summary
buffer is already built using the original `gnus-summary-line-format'
value.
The patch below fixes this problem. Could someone with a bit more Gnus
knowledge have a look at it and tell me if IDRT?
--8<---------------cut here---------------start------------->8---
1 file changed, 7 insertions(+), 2 deletions(-)
lisp/gnus/nnir.el | 9 +++++++--
modified lisp/gnus/nnir.el
@@ -663,6 +663,7 @@ nnir-open-server
(let ((backend (car (gnus-server-to-method server))))
(if backend
(nnoo-change-server backend server definitions)
+ (add-hook 'gnus-summary-generate-hook 'nnir-summary-generate-setup)
(add-hook 'gnus-summary-prepared-hook 'nnir-mode)
(nnoo-change-server 'nnir server definitions))))
@@ -1848,10 +1849,14 @@ nnir-registry-action
to
method))
+(defun nnir-summary-generate-setup ()
+ (when (and (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir)
+ nnir-summary-line-format)
+ (setq gnus-summary-line-format nnir-summary-line-format)
+ (gnus-update-format-specifications nil 'summary)))
+
(defun nnir-mode ()
(when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir)
- (setq gnus-summary-line-format
- (or nnir-summary-line-format gnus-summary-line-format))
(when (bound-and-true-p gnus-registry-enabled)
(remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t)
(remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t)
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nnir-summary-line-format doesn't work
2020-06-06 9:21 nnir-summary-line-format doesn't work Tassilo Horn
@ 2020-06-06 20:10 ` Eric Abrahamsen
2020-06-07 8:04 ` Tassilo Horn
0 siblings, 1 reply; 4+ messages in thread
From: Eric Abrahamsen @ 2020-06-06 20:10 UTC (permalink / raw)
To: Tassilo Horn; +Cc: ding
Tassilo Horn <tsdh@gnu.org> writes:
> Hi all,
>
> it seems like `nnir-summary-line-format' doesn't work in the current
> Emacs master (and probably hasn't worked for ages). It gets set as
> `gnus-summary-line-format' in `nnir-mode' which is called in
> `gnus-summary-prepared-hook'. However, at that point, the summary
> buffer is already built using the original `gnus-summary-line-format'
> value.
>
> The patch below fixes this problem. Could someone with a bit more Gnus
> knowledge have a look at it and tell me if IDRT?
I would expect that you can just move all of `nnir-mode' to
`gnus-summary-generate-hook'. The only other thing `nnir-mode' does is
mess with the article-(delete|move|expire)-hook, and those hooks have
all had their local values set by this stage.
It would be a simpler solution, anyway -- try it out and see if anything
goes wrong?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nnir-summary-line-format doesn't work
2020-06-06 20:10 ` Eric Abrahamsen
@ 2020-06-07 8:04 ` Tassilo Horn
2020-06-07 15:36 ` Eric Abrahamsen
0 siblings, 1 reply; 4+ messages in thread
From: Tassilo Horn @ 2020-06-07 8:04 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: ding
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
Hi Eric,
>> The patch below fixes this problem. Could someone with a bit more
>> Gnus knowledge have a look at it and tell me if IDRT?
>
> I would expect that you can just move all of `nnir-mode' to
> `gnus-summary-generate-hook'. The only other thing `nnir-mode' does is
> mess with the article-(delete|move|expire)-hook, and those hooks have
> all had their local values set by this stage.
>
> It would be a simpler solution, anyway -- try it out and see if
> anything goes wrong?
Seems to work. So I would like to push this change:
--8<---------------cut here---------------start------------->8---
1 file changed, 6 insertions(+), 3 deletions(-)
lisp/gnus/nnir.el | 9 ++++++---
modified lisp/gnus/nnir.el
@@ -663,7 +663,7 @@ nnir-open-server
(let ((backend (car (gnus-server-to-method server))))
(if backend
(nnoo-change-server backend server definitions)
- (add-hook 'gnus-summary-prepared-hook 'nnir-mode)
+ (add-hook 'gnus-summary-generate-hook 'nnir-mode)
(nnoo-change-server 'nnir server definitions))))
(deffoo nnir-request-group (group &optional server dont-check _info)
@@ -1850,8 +1850,11 @@ nnir-registry-action
(defun nnir-mode ()
(when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir)
- (setq gnus-summary-line-format
- (or nnir-summary-line-format gnus-summary-line-format))
+ (when (and nnir-summary-line-format
+ (not (string= nnir-summary-line-format
+ gnus-summary-line-format)))
+ (setq gnus-summary-line-format nnir-summary-line-format)
+ (gnus-update-format-specifications nil 'summary))
(when (bound-and-true-p gnus-registry-enabled)
(remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t)
(remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t)
--8<---------------cut here---------------end--------------->8---
The `gnus-update-format-specifications' seems to be needed anyway when a
different summary line should be shown in nnir summaries.
I'd like to push to emacs-27 (given that the nnir code is almost the
same there), although I couldn't test it there because of an error.
When I do a nnir search there which has any matches, I get to an infloop
where Emacs blinks and repeatedly shows
No more unread articles
in the echo area. Even C-g doesn't break out of that loop.
Hm, now I've tried with emacs -Q (emacs-27 with my normal ~/.gnus.el),
and then the error doesn't happen but I can reproduce the
`nnir-summary-line-format' problem and verify the fix. So I'll push it.
Thanks,
Tassilo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nnir-summary-line-format doesn't work
2020-06-07 8:04 ` Tassilo Horn
@ 2020-06-07 15:36 ` Eric Abrahamsen
0 siblings, 0 replies; 4+ messages in thread
From: Eric Abrahamsen @ 2020-06-07 15:36 UTC (permalink / raw)
To: Tassilo Horn; +Cc: ding
Tassilo Horn <tsdh@gnu.org> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
> Hi Eric,
>
>>> The patch below fixes this problem. Could someone with a bit more
>>> Gnus knowledge have a look at it and tell me if IDRT?
>>
>> I would expect that you can just move all of `nnir-mode' to
>> `gnus-summary-generate-hook'. The only other thing `nnir-mode' does is
>> mess with the article-(delete|move|expire)-hook, and those hooks have
>> all had their local values set by this stage.
>>
>> It would be a simpler solution, anyway -- try it out and see if
>> anything goes wrong?
>
> Seems to work. So I would like to push this change:
>
> 1 file changed, 6 insertions(+), 3 deletions(-)
> lisp/gnus/nnir.el | 9 ++++++---
>
> modified lisp/gnus/nnir.el
> @@ -663,7 +663,7 @@ nnir-open-server
> (let ((backend (car (gnus-server-to-method server))))
> (if backend
> (nnoo-change-server backend server definitions)
> - (add-hook 'gnus-summary-prepared-hook 'nnir-mode)
> + (add-hook 'gnus-summary-generate-hook 'nnir-mode)
> (nnoo-change-server 'nnir server definitions))))
>
> (deffoo nnir-request-group (group &optional server dont-check _info)
> @@ -1850,8 +1850,11 @@ nnir-registry-action
>
> (defun nnir-mode ()
> (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir)
> - (setq gnus-summary-line-format
> - (or nnir-summary-line-format gnus-summary-line-format))
> + (when (and nnir-summary-line-format
> + (not (string= nnir-summary-line-format
> + gnus-summary-line-format)))
> + (setq gnus-summary-line-format nnir-summary-line-format)
> + (gnus-update-format-specifications nil 'summary))
> (when (bound-and-true-p gnus-registry-enabled)
> (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t)
> (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t)
>
> The `gnus-update-format-specifications' seems to be needed anyway when a
> different summary line should be shown in nnir summaries.
>
> I'd like to push to emacs-27 (given that the nnir code is almost the
> same there), although I couldn't test it there because of an error.
> When I do a nnir search there which has any matches, I get to an infloop
> where Emacs blinks and repeatedly shows
Patch looks good to me, and I see it's in. Hope Eli doesn't bite you for
making Emacs 27 changes at this late hour... :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-07 15:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-06 9:21 nnir-summary-line-format doesn't work Tassilo Horn
2020-06-06 20:10 ` Eric Abrahamsen
2020-06-07 8:04 ` Tassilo Horn
2020-06-07 15:36 ` Eric Abrahamsen
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).