From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/88195 Path: news.gmane.org!.POSTED!not-for-mail From: "Garreau\, Alexandre" Newsgroups: gmane.emacs.gnus.general Subject: message-simplify-subject too coupled with reply (and not extensible) Date: Sun, 28 Oct 2018 20:23:24 +0100 Message-ID: <87zhux7u4z.fsf@portable.galex-713.eu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1540754510 1188 195.159.176.226 (28 Oct 2018 19:21:50 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2018 19:21:50 +0000 (UTC) User-Agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian To: ding@gnus.org Original-X-From: ding-owner+M36409@lists.math.uh.edu Sun Oct 28 20:21:46 2018 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from lists1.math.uh.edu ([129.7.128.208]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGqd7-0000BL-UL for ding-account@gmane.org; Sun, 28 Oct 2018 20:21:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.90_1) (envelope-from ) id 1gGqew-0003KX-Qf; Sun, 28 Oct 2018 14:23:38 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gGqeo-0003Hm-2n for ding@lists.math.uh.edu; Sun, 28 Oct 2018 14:23:30 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1gGqem-0006wG-27 for ding@lists.math.uh.edu; Sun, 28 Oct 2018 14:23:29 -0500 Original-Received: from portable.galex-713.eu ([89.234.186.82]) by quimby.gnus.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGqek-0006L6-RA for ding@gnus.org; Sun, 28 Oct 2018 20:23:26 +0100 Original-Received: from localhost ([::1] helo=portable.galex-713.eu) by portable.galex-713.eu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gGqej-0007hC-1L for ding@gnus.org; Sun, 28 Oct 2018 20:23:25 +0100 PGP-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F Accept-Language: fr, en, eo, it, br X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:88195 Archived-At: 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=E2=80=99d like a function to remove the inner =E2=80=9Cwas=E2=80= =9Ds 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 =E2=80=9CRe:=E2=80=9D=E2=80=A6 and add a new one! so i= n the end, `message-reply' doesn=E2=80=99t do that: that fills terribly wrong. `message-reply' should add a =E2=80=9CRe:=E2=80=9D (that=E2=80=99s the leas= t expectable from it, it=E2=80=99s 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=E2=80=99s impossible because of this oddity (otherwise the message could= be falsely seen as a reply while it isn=E2=80=99t one). If it was possible, t= he 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 =E2=80=9C(message-simplify-subject subject)=E2=80=9D with =E2=80=9C(concat "Re: " (message-simplify-subject su= bject))=E2=80=9D, and also, `message-strip-list-identifiers should get a =E2=80=9Cunless (equal gnus-list-identifiers "")=E2=80=9D around the body of its outer `let' (not mandatory, but otherwise `message-strip-list-identifiers' might remove a =E2=80=9CRe:=E2=80=9D, what `message-strip-subject-re' should do, even if i= t wasn=E2=80=99t 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=E2=80=99t used elsewhere than in message.el. It is also shorter, in total.