From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/88197 Path: news.gmane.org!.POSTED!not-for-mail From: "Garreau\, Alexandre" Newsgroups: gmane.emacs.gnus.general Subject: Re: message-simplify-subject too coupled with reply (and not extensible) Date: Mon, 29 Oct 2018 11:49:11 +0100 Message-ID: <87sh0pvxi0.fsf@portable.galex-713.eu> References: <87zhux7u4z.fsf@portable.galex-713.eu> <87k1m1zedm.fsf@ericabrahamsen.net> 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 1540810093 25075 195.159.176.226 (29 Oct 2018 10:48:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Oct 2018 10:48:13 +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 Cc: ding@gnus.org To: Eric Abrahamsen Original-X-From: ding-owner+M36411@lists.math.uh.edu Mon Oct 29 11:48:09 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 1gH55d-0006PB-BX for ding-account@gmane.org; Mon, 29 Oct 2018 11:48:09 +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 1gH56y-0001yQ-BR; Mon, 29 Oct 2018 05:49:32 -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 1gH56n-0001vK-Qz for ding@lists.math.uh.edu; Mon, 29 Oct 2018 05:49:21 -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 1gH56l-0001aW-FH for ding@lists.math.uh.edu; Mon, 29 Oct 2018 05:49:21 -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 1gH56i-0002ys-Ok for ding@gnus.org; Mon, 29 Oct 2018 11:49:16 +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 1gH56e-0003pd-No; Mon, 29 Oct 2018 11:49:13 +0100 PGP-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F Accept-Language: fr, en, eo, it, br In-Reply-To: <87k1m1zedm.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 28 Oct 2018 19:16:21 -0700") X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:88197 Archived-At: On 2018/10/28 at 19:16, Eric Abrahamsen wrote: > "Garreau, Alexandre" 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 =E2=80=9CRe:=E2=80=9D=E2=80=A6 and add a new one! s= o in 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 l= east 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'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=E2=80=99m 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=E2=80=99s impossible because of this oddity (otherwise the message co= uld be >> falsely seen as a reply while it isn=E2=80=99t 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 =E2=80=9C(message-simplify-subject >> subject)=E2=80=9D with =E2=80=9C(concat "Re: " (message-simplify-subject= subject))=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' (n= ot >> mandatory, but otherwise `message-strip-list-identifiers' might remove a >> =E2=80=9CRe:=E2=80=9D, what `message-strip-subject-re' should do, even i= f it wasn=E2=80=99t >> 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. =E2=80=9Cthere=E2=80=9D where? sorry I don=E2=80=99t understand the relatio= nship 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=E2=80=99t 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=E2=80=99m sometimes confused about how much tight = is Gnus to Emacs.