* Set gnus-simplify-subject-functions in group parameters?
@ 2017-02-23 13:51 Tim Landscheidt
2017-02-24 1:29 ` Katsumi Yamaoka
0 siblings, 1 reply; 8+ messages in thread
From: Tim Landscheidt @ 2017-02-23 13:51 UTC (permalink / raw)
To: ding
Hi,
I receive watchlist notifications from Wikipedia and sort
them into a group. I want to thread them by page, i. e.:
| [ 35: Wikipedia ] Wikipedia-Seite Diskussion:Lasithi-Hochebene wurde von Langläufer erstellt
| [ 41: Wikipedia ] Wikipedia-Seite Lasithi-Hochebene wurde von Langläufer geändert
| [ 40: Wikipedia ] Wikipedia-Seite Lasithi wurde von Langläufer geändert
should be displayed as:
| [ 35: Wikipedia ] Wikipedia-Seite Diskussion:Lasithi-Hochebene wurde von Langläufer erstellt
| < 41: Wikipedia > Wikipedia-Seite Lasithi-Hochebene wurde von Langläufer geändert
| [ 40: Wikipedia ] Wikipedia-Seite Lasithi wurde von Langläufer geändert
I read "Customizing Threading", thought
gnus-simplify-subject-functions would be a good idea,
created a function for testing and set the group parameters
to:
| ((auto-expire . t)
| (gnus-simplify-subject-functions
| (tl-watchlist-subject-munger)))
But when I enter the group, the function is not called.
edebug showed that gnus-gather-threads-by-subject is called,
but gnus-simplify-subject-functions's value there is (the
default) (gnus-simplify-subject-re
gnus-simplify-whitespace).
How can I set gnus-simplify-subject-functions for a group to
a different value?
TIA,
Tim
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Set gnus-simplify-subject-functions in group parameters?
2017-02-23 13:51 Set gnus-simplify-subject-functions in group parameters? Tim Landscheidt
@ 2017-02-24 1:29 ` Katsumi Yamaoka
2017-02-24 11:10 ` Andreas Schwab
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Katsumi Yamaoka @ 2017-02-24 1:29 UTC (permalink / raw)
To: ding
Er, first of all, does `gnus-simplify-subject-functions' really
work? I tried this,
(setq gnus-simplify-subject-functions '(gnus-simplify-subject-re))
and confirmed that `gnus-simplify-subject-re' runs. However I
can still see "Re: "s in the summary lines. :(
On Thu, 23 Feb 2017 13:51:02 +0000, Tim Landscheidt wrote:
> How can I set gnus-simplify-subject-functions for a group to
> a different value?
If it works, something like the following will probably work:
--8<---------------cut here---------------start------------->8---
(defun my-gnus-simplify-subject ()
(setq gnus-simplify-subject-functions
(cond ((string-equal "nnfolder:foo.bar" gnus-newsgroup-name)
'(tl-watchlist-subject-munger))
((string-match "\\`nnimap:foo\\." gnus-newsgroup-name)
'(tl-subject-filter-2))
(t nil))))
(add-hook 'gnus-select-group-hook 'my-gnus-simplify-subject)
--8<---------------cut here---------------end--------------->8---
(string-equal "nnfolder:foo.bar" ...) matches the group.
(string-match "\\`nnimap:foo\\." ...) matches the groups of which
the group names begin with "nnimap:foo." .
The last (t nil) must be there.
Unfortunately Gnus isn't designed assuming
`gnus-simplify-subject-functions' to be a group parameter, IIUC.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Set gnus-simplify-subject-functions in group parameters?
2017-02-24 1:29 ` Katsumi Yamaoka
@ 2017-02-24 11:10 ` Andreas Schwab
2017-02-25 11:00 ` Reiner Steib
2017-03-06 2:31 ` Tim Landscheidt
2 siblings, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2017-02-24 11:10 UTC (permalink / raw)
To: Katsumi Yamaoka; +Cc: ding
On Feb 24 2017, Katsumi Yamaoka <yamaoka@jpl.org> wrote:
> The last (t nil) must be there.
Does it? If no condition succeeds, cond returns nil.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Set gnus-simplify-subject-functions in group parameters?
2017-02-24 1:29 ` Katsumi Yamaoka
2017-02-24 11:10 ` Andreas Schwab
@ 2017-02-25 11:00 ` Reiner Steib
2017-02-27 6:35 ` Katsumi Yamaoka
2017-03-06 2:16 ` Tim Landscheidt
2017-03-06 2:31 ` Tim Landscheidt
2 siblings, 2 replies; 8+ messages in thread
From: Reiner Steib @ 2017-02-25 11:00 UTC (permalink / raw)
To: ding
On Fri, Feb 24 2017, Katsumi Yamaoka wrote:
> Er, first of all, does `gnus-simplify-subject-functions' really
> work? I tried this,
> (setq gnus-simplify-subject-functions '(gnus-simplify-subject-re))
> and confirmed that `gnus-simplify-subject-re' runs. However I
> can still see "Re: "s in the summary lines. :(
I guess `gnus-simplify-subject-functions' is used for threading and
scoring and doesn't influence the display (in summary and article
buffers). For the latter, `gnus-list-identifiers' might be useful.
With the following code, I can see that the function rs-test is called
twice for each article (after turning on threading):
| Generating summary...done
| No more unseen articles
| No more unread articles
| SIMPLIFY: subdomain adressing
| SIMPLIFY: Test-von-Reiner
| Generating summary...
| SIMPLIFY: subdomain adressing
| SIMPLIFY: Test-von-Reiner
| Generating summary...done
| Threading is now on
(defun rs-test (s) (message "SIMPLIFY: %s" s))
(setq
gnus-parameters
`(;; ...
("misc\\.test"
(gnus-simplify-subject-functions
'(gnus-simplify-subject-re
gnus-simplify-whitespace
rs-test))
(gnus-summary-line-format "..."))
...))
Bye, Reiner.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Set gnus-simplify-subject-functions in group parameters?
2017-02-25 11:00 ` Reiner Steib
@ 2017-02-27 6:35 ` Katsumi Yamaoka
2017-03-06 2:16 ` Tim Landscheidt
1 sibling, 0 replies; 8+ messages in thread
From: Katsumi Yamaoka @ 2017-02-27 6:35 UTC (permalink / raw)
To: ding
Thanks a lot Andreas and Reiner. So, Tim, what you want to use
would probably be `gnus-list-identifiers', I guess. Note that
if it is a regexp, the one atutually used is:
(concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)")
cf. `gnus-summary-remove-list-identifiers'
You can use one of the following ways (all I confirmed):
;; Set it globally:
(setq gnus-list-identifiers "Wikipedia-Seite")
;; Set it per group (use `gnus-parameters'):
(add-to-list
'gnus-parameters
'("\\`nnxx:foo\\.bar\\'"
(gnus-list-identifiers "Wikipedia-Seite")))
;; Set it per group (use the `G c' buffer):
[X] Identifier: [Value Menu] Regexp: Wikipedia-Seite
If non-nil, specify how to remove ‘identifiers’ from articles’ subject. More
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Set gnus-simplify-subject-functions in group parameters?
2017-02-25 11:00 ` Reiner Steib
2017-02-27 6:35 ` Katsumi Yamaoka
@ 2017-03-06 2:16 ` Tim Landscheidt
1 sibling, 0 replies; 8+ messages in thread
From: Tim Landscheidt @ 2017-03-06 2:16 UTC (permalink / raw)
To: ding
Reiner Steib <reinersteib+gmane@imap.cc> wrote:
>> Er, first of all, does `gnus-simplify-subject-functions' really
>> work? I tried this,
>> (setq gnus-simplify-subject-functions '(gnus-simplify-subject-re))
>> and confirmed that `gnus-simplify-subject-re' runs. However I
>> can still see "Re: "s in the summary lines. :(
> I guess `gnus-simplify-subject-functions' is used for threading and
> scoring and doesn't influence the display (in summary and article
> buffers). For the latter, `gnus-list-identifiers' might be useful.
Yes, and I do not want to change the display, but just group
together articles that refer to the same "topic".
> With the following code, I can see that the function rs-test is called
> twice for each article (after turning on threading):
> | Generating summary...done
> | No more unseen articles
> | No more unread articles
> | SIMPLIFY: subdomain adressing
> | SIMPLIFY: Test-von-Reiner
> | Generating summary...
> | SIMPLIFY: subdomain adressing
> | SIMPLIFY: Test-von-Reiner
> | Generating summary...done
> | Threading is now on
> (defun rs-test (s) (message "SIMPLIFY: %s" s))
> (setq
> gnus-parameters
> `(;; ...
> ("misc\\.test"
> (gnus-simplify-subject-functions
> '(gnus-simplify-subject-re
> gnus-simplify-whitespace
> rs-test))
> (gnus-summary-line-format "..."))
> ...))
I cannot reproduce this with Gnus v5.13 (GNU Emacs 25.1.1).
If I set:
| (setq gnus-parameters
| '(("^mail\\.wikipedia\\.watchlist\\.dewiki$"
| (gnus-thread-sort-functions '(gnus-thread-sort-by-subject)))))
gnus-thread-sort-functions is gnus-thread-sort-by-subject in
the summary buffer (and the sorting is changed from the de-
fault), so the parameters are read. If I set:
| (setq gnus-parameters
| '(("^mail\\.wikipedia\\.watchlist\\.dewiki$"
| (gnus-simplify-subject-functions
| '(gnus-simplify-subject-re
| gnus-simplify-whitespace
| rs-test)))))
(and gnus-verbose to 99), when entering the group *Messages*
only says:
| Retrieving newsgroup: mail.wikipedia.watchlist.dewiki...
| Fetching headers for mail.wikipedia.watchlist.dewiki...done
| Scoring...done
| Sorting threads...done
| Generating summary...done
and gnus-simplify-subject-functions is still
'(gnus-simplify-subject-re gnus-simplify-whitespace).
Tim
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Set gnus-simplify-subject-functions in group parameters?
2017-02-24 1:29 ` Katsumi Yamaoka
2017-02-24 11:10 ` Andreas Schwab
2017-02-25 11:00 ` Reiner Steib
@ 2017-03-06 2:31 ` Tim Landscheidt
2017-03-16 19:36 ` Tim Landscheidt
2 siblings, 1 reply; 8+ messages in thread
From: Tim Landscheidt @ 2017-03-06 2:31 UTC (permalink / raw)
To: ding
Katsumi Yamaoka <yamaoka@jpl.org> wrote:
> […]
>> How can I set gnus-simplify-subject-functions for a group to
>> a different value?
> If it works, something like the following will probably work:
> (defun my-gnus-simplify-subject ()
> (setq gnus-simplify-subject-functions
> (cond ((string-equal "nnfolder:foo.bar" gnus-newsgroup-name)
> '(tl-watchlist-subject-munger))
> ((string-match "\\`nnimap:foo\\." gnus-newsgroup-name)
> '(tl-subject-filter-2))
> (t nil))))
> (add-hook 'gnus-select-group-hook 'my-gnus-simplify-subject)
> (string-equal "nnfolder:foo.bar" ...) matches the group.
> (string-match "\\`nnimap:foo\\." ...) matches the groups of which
> the group names begin with "nnimap:foo." .
> The last (t nil) must be there.
Thanks, I'll try (something like) that.
> Unfortunately Gnus isn't designed assuming
> `gnus-simplify-subject-functions' to be a group parameter, IIUC.
What is the difference between "good" and "bad" group para-
meters in Lisp? I. e., why does gnus-thread-sort-functions
work, but gnus-simplify-subject-functions does not?
Tim
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Set gnus-simplify-subject-functions in group parameters?
2017-03-06 2:31 ` Tim Landscheidt
@ 2017-03-16 19:36 ` Tim Landscheidt
0 siblings, 0 replies; 8+ messages in thread
From: Tim Landscheidt @ 2017-03-16 19:36 UTC (permalink / raw)
To: ding
I wrote:
> […]
> Thanks, I'll try (something like) that.
> […]
I found that the solution with
gnus-simplify-subject-functions does not meet my use case; I
wanted:
| [ 35: Wikipedia ] Wikipedia-Seite Diskussion:Lasithi-Hochebene wurde von Langläufer erstellt
| [ 41: Wikipedia ] Wikipedia-Seite Lasithi-Hochebene wurde von Langläufer geändert
| [ 40: Wikipedia ] Wikipedia-Seite Lasithi wurde von Langläufer geändert
to be displayed as:
| [ 35: Wikipedia ] Wikipedia-Seite Diskussion:Lasithi-Hochebene wurde von Langläufer erstellt
| < 41: Wikipedia > Wikipedia-Seite Lasithi-Hochebene wurde von Langläufer geändert
| [ 40: Wikipedia ] Wikipedia-Seite Lasithi wurde von Langläufer geändert
However, with gnus-simplify-subject-functions munging the
subject, I ended up with (IIRC, did not record it):
| [ 35: Wikipedia ] Wikipedia-Seite Diskussion:Lasithi-Hochebene wurde von Langläufer erstellt
| [ 41: Wikipedia ]
| [ 40: Wikipedia ] Wikipedia-Seite Lasithi wurde von Langläufer geändert
i. e. the different subjects were not displayed. So I
looked a bit more at the threading code and viewed my prob-
lem as the addition of a reference to a fake thread root
"Wikipedia page Lasithi-Hochebene". I set the group parame-
ters to:
| ((gnus-alter-header-function
| (lambda
| (header)
| (let*
| ((references
| (mail-header-references header))
| (subject
| (mail-header-subject header))
| (reference-to-add
| (cond
| ((string-match "^Wikipedia-Seite \\(Benutzer\\|Hilfe\\|Kategorie\\|Portal\\|Vorlage\\|Wikipedia\\)\\(?: Diskussion\\)?:\\(.*\\) wurde von .* \\(?:erstellt\\|geändert\\|gelöscht\\)$" subject)
| (concat
| (match-string 1 subject)
| ":"
| (match-string 2 subject)))
| ((string-match "^Wikipedia-Seite \\(?:Diskussion:\\)?\\(.*\\) wurde von .* \\(?:erstellt\\|geändert\\|gelöscht\\)$" subject)
| (match-string 1 subject)))))
| (if reference-to-add
| (let
| ((encoded-reference-to-add
| (concat "<"
| (base64-encode-string reference-to-add t)
| "@de.wikipedia.org>")))
| (mail-header-set-references header
| (if
| (string-equal "" references)
| encoded-reference-to-add
| (concat references " " encoded-reference-to-add))))))))
| (gnus-summary-thread-gathering-function
| (lambda
| (threads)
| (gnus-gather-threads-by-references threads))))
It is currently not possible to directly set
gnus-summary-thread-gathering-function to
gnus-gather-threads-by-references due to
https://debbugs.gnu.org/26105, so the latter setting works
around for that.
The function for gnus-alter-header-function should be easy
to understand; encoding the page title in Base64 is probably
overly cautious and careless at the same time (is "=" legal
in message IDs?), but it works for me so far.
After a long session with edebug, I also added:
| (setq gnus-newsgroup-variables '(gnus-alter-header-function))
to my ~/.emacs. This is necessary because
gnus-get-newsgroup-headers-xover calls gnus-nov-parse-line
(which calls gnus-alter-header-function) framed by:
| […]
| (with-current-buffer nntp-server-buffer
| […]
Without gnus-newsgroup-variables the group parameters are
only set for the summary buffer, so
gnus-alter-header-function would be always nil (or whatever
the global value is).
HTH,
Tim
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-03-16 19:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 13:51 Set gnus-simplify-subject-functions in group parameters? Tim Landscheidt
2017-02-24 1:29 ` Katsumi Yamaoka
2017-02-24 11:10 ` Andreas Schwab
2017-02-25 11:00 ` Reiner Steib
2017-02-27 6:35 ` Katsumi Yamaoka
2017-03-06 2:16 ` Tim Landscheidt
2017-03-06 2:31 ` Tim Landscheidt
2017-03-16 19:36 ` Tim Landscheidt
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).