Gnus development mailing list
 help / color / mirror / Atom feed
* message-simplify-subject too coupled with reply (and not extensible)
@ 2018-10-28 19:23 Garreau, Alexandre
  2018-10-29  2:16 ` Eric Abrahamsen
  0 siblings, 1 reply; 10+ messages in thread
From: Garreau, Alexandre @ 2018-10-28 19:23 UTC (permalink / raw)
  To: ding

After having discovered `message-strip-subject-trailing-was', I searched
for how it was used and if there were similar functions, and there were,
all in `message-simplify-subject-functions', quite interesting one.

One critic is, their standard caller, `message-simplify-subject', work
only for the 4 default functions (stopping users from adding their own
custom functions in addition or replacement of the default ones (for
instance I’d like a function to remove the inner “was”s but not the
outer one)), instead of recursively applying them all to the said
subject (after all their have the same call semantics: one argument: the
subject!).

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 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

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').

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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-11-01  4:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-28 19:23 message-simplify-subject too coupled with reply (and not extensible) Garreau, Alexandre
2018-10-29  2:16 ` Eric Abrahamsen
2018-10-29 10:49   ` Garreau, Alexandre
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

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).