Gnus development mailing list
 help / color / mirror / Atom feed
From: "Garreau\, Alexandre" <galex-713@galex-713.eu>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: ding@gnus.org
Subject: Re: message-simplify-subject too coupled with reply (and not extensible)
Date: Mon, 29 Oct 2018 11:49:11 +0100	[thread overview]
Message-ID: <87sh0pvxi0.fsf@portable.galex-713.eu> (raw)
In-Reply-To: <87k1m1zedm.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 28 Oct 2018 19:16:21 -0700")

On 2018/10/28 at 19:16, Eric Abrahamsen wrote:
> "Garreau, Alexandre" <galex-713@galex-713.eu> writes:
>> But the main problem is, as this function call manually each of these
>> four functions, in the special case of `message-strip-subject-re', it
>> removes excedentary “Re:”… and add a new one!  so in the end,
>> `message-reply' doesn’t do that: that fills terribly wrong.
>> `message-reply' should add a “Re:” (that’s the least expectable from it,
>> it’s confusing it is not it that does it), and
>> `message-simplify-subject' should do what its name says, so that to be
>> really useful: simplify subject, not prepare it for another different
>> function (namely, `message-reply')!
>
> I'm less certain about this. It's one of those cases where probably no
> one remembers why it is the way it is, and no one wants to touch it
> because who knows how things might suddenly break.

I’m pretty sure el-search can be used so that to quickly check how is
it: I checked in all gnus, and the symbol `gnus-simplify-subject' is
only used in `message-reply'.  So unless you do strange stuff with
symbol names twiddling or other complex stuff (I believe you are
confident enough in not abusing such things in gnus) so to get it
without naming it, it is okay. ^^

> If I were you I would report two separate bugs, so that the first had
> a better chance of being accepted.

These are separate problems anyway.

>> I wanted to see this function used in `org-email-link-description', but
>> it’s impossible because of this oddity (otherwise the message could be
>> falsely seen as a reply while it isn’t one).  If it was possible, the
>> subject cited in org links could be *semantically* shorter (rather than
>> blindly arbitrarily cut in the middle), and benefit from user
>> customizations and extensions.
>>
>> May I propose the following implementation:
>>
>> #+BEGIN_SRC emacs-lisp
>>   (defun message-simplify-subject (subject &optional functions)
>> "Return simplified SUBJECT"
>>     (let ((functions (or functions message-simplify-subject-functions)))
>>       (if functions
>>           (let ((fun (car functions))
>>                 (other-funs (cdr functions)))
>>             (message-simplify-subject (funcall fun subject) other-funs))
>>         subject)))
>> #+END_SRC
>
> That looks fine, though you just don't see a whole lot of recursion used
> in the Emacs codebase. This is the sort of thing I like the `seq'
> functions for:
>
> (seq-reduce (lambda (subject fun)
> 	      (funcall fun subject))
> 	    message-simplify-subject-functions subject)
>
> Or just a simple dolist and setq.

Ah indeed, a dolist will do then:

#+BEGIN_SRC emacs-lisp
  (defun message-simplify-subject (subject &optional functions)
    "Return simplified SUBJECT"
    (dolist (fun (or functions message-simplify-subject-functions) subject)
      (setq subject (funcall fun subject))))
#+END_SRC

>> Then, `message-reply' should replace “(message-simplify-subject
>> subject)” with “(concat "Re: " (message-simplify-subject subject))”, and
>> also, `message-strip-list-identifiers should get a “unless (equal
>> gnus-list-identifiers "")” around the body of its outer `let' (not
>> mandatory, but otherwise `message-strip-list-identifiers' might remove a
>> “Re:”, what `message-strip-subject-re' should do, even if it wasn’t
>> asked by the user by being put in `message-simplify-subject-functions').
>
> And `message-strip-subject-trailing-was' already checks
> `message-subject-trailing-was-query', so the extra check there is
> redundant, which would mean `message-simplify-subject' really could just
> be a simple reduction function.

“there” where? sorry I don’t understand the relationship with the
preceding quoted text.

>> May I also suggest, for consistency, to rename
>> `message-strip-list-identifiers' to
>> `message-strip-subject-list-identifiers'.  I guess it isn’t used
>> elsewhere than in message.el.
>>
>> It is also shorter, in total.
>
> I would file a couple of bug reports.

So should I have bugreported from the beginning?  Btw, do Gnus bugs
belong to bug-gnu-emacs mailing-list too? or is there something separate
about Gnus there too?  I’m sometimes confused about how much tight is
Gnus to Emacs.



  reply	other threads:[~2018-10-29 10:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-28 19:23 Garreau, Alexandre
2018-10-29  2:16 ` Eric Abrahamsen
2018-10-29 10:49   ` Garreau, Alexandre [this message]
2018-10-29 17:17     ` Eric Abrahamsen
2018-10-30  2:47       ` Garreau, Alexandre
2018-10-30  4:57       ` `gnus-bug' bug? [Was: Re: message-simplify-subject too coupled with reply (and not extensible)] Garreau, Alexandre
2018-10-30 21:33         ` `gnus-bug' bug? [ Eric Abrahamsen
2018-11-01  4:17           ` `gnus-bug' bug? Garreau, Alexandre
2018-10-30 12:28   ` Two successive patches about the same function [Was: Re: message-simplify-subject too coupled with reply (and not extensible)] Garreau, Alexandre
2018-10-30 21:35     ` Two successive patches about the same function [ Eric Abrahamsen

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=87sh0pvxi0.fsf@portable.galex-713.eu \
    --to=galex-713@galex-713.eu \
    --cc=ding@gnus.org \
    --cc=eric@ericabrahamsen.net \
    /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).