Gnus development mailing list
 help / color / mirror / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: ding@gnus.org
Subject: Re: Set gnus-simplify-subject-functions in group parameters?
Date: Thu, 16 Mar 2017 19:36:42 +0000	[thread overview]
Message-ID: <87k27p814l.fsf@passepartout.tim-landscheidt.de> (raw)
In-Reply-To: <87o9xfjfub.fsf@passepartout.tim-landscheidt.de>

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




      reply	other threads:[~2017-03-16 19:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 13:51 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 message]

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=87k27p814l.fsf@passepartout.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=ding@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.
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).