From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Garreau\, Alexandre" Newsgroups: gmane.emacs.bugs Subject: bug#33224: `message-simplify-subject' simplification (and extensibility) Date: Thu, 01 Nov 2018 07:21:13 +0100 Message-ID: <87zhutmi7a.fsf@portable.galex-713.eu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1541053214 6598 195.159.176.226 (1 Nov 2018 06:20:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Nov 2018 06:20:14 +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: 33224@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 01 07:20:10 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gI6Kv-0001UN-Oc for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Nov 2018 07:20:09 +0100 Original-Received: from localhost ([::1]:35611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI6Mw-00040P-Rb for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Nov 2018 02:22:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI6Mp-00040J-JZ for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2018 02:22:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gI6Ml-0001Yb-GO for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2018 02:22:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53429) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gI6Ml-0001YU-AV for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2018 02:22:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gI6Mk-0007NB-8x; Thu, 01 Nov 2018 02:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Garreau\, Alexandre" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Thu, 01 Nov 2018 06:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33224 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: X-Debbugs-Original-To: submit@debbugs.gnu.org (The Gnus Bugfixing Girls + Boys) Original-Received: via spool by submit@debbugs.gnu.org id=B.154105327628281 (code B ref -1); Thu, 01 Nov 2018 06:22:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Nov 2018 06:21:16 +0000 Original-Received: from localhost ([127.0.0.1]:57685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gI6M0-0007M5-F4 for submit@debbugs.gnu.org; Thu, 01 Nov 2018 02:21:16 -0400 Original-Received: from portable.galex-713.eu ([89.234.186.82]:46654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gI6Lz-0007Lx-2p for submit@debbugs.gnu.org; Thu, 01 Nov 2018 02:21:15 -0400 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 1gI6Lx-0005O6-K4 for submit@debbugs.gnu.org; Thu, 01 Nov 2018 07:21:13 +0100 PGP-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F Accept-Language: fr, en, eo, it, br X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151884 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, here a patch simplyfing `message-simplify-subject' to make it extensible (users can now add their own tailor-made one-arg function to `message-simplify-subject-functions'), by removing all the explicit checks and funcall, and just calling all the functions (implicit check for `message-strip-list-identifiers' is moved to its body, and one for `message-strip-subject-re' is removed based on previous patch from ). This is my second patch, please tell-me if there=E2=80=99s a problem anywhe= re. Not sure if I know how to make patch properly, nor to report bugs properly. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=message-simplify-subject.patch diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 0c743bd3aa..acd581226a 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2052,8 +2052,9 @@ see `message-narrow-to-headers-or-head'." (let ((regexp (if (stringp gnus-list-identifiers) gnus-list-identifiers (mapconcat 'identity gnus-list-identifiers " *\\|")))) - (if (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp - " *\\)\\)+\\(Re: +\\)?\\)") subject) + (if (and (not (equal regexp "")) + (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp + " *\\)\\)+\\(Re: +\\)?\\)") subject)) (concat (substring subject 0 (match-beginning 1)) (or (match-string 3 subject) (match-string 5 subject)) @@ -6942,21 +6943,12 @@ Useful functions to put in this list include: :type '(repeat function)) (defun message-simplify-subject (subject &optional functions) - "Return simplified SUBJECT." - (unless functions - ;; Simplify fully: - (setq functions message-simplify-subject-functions)) - (when (and (memq 'message-strip-list-identifiers functions) - gnus-list-identifiers) - (setq subject (message-strip-list-identifiers subject))) - (when (memq 'message-strip-subject-re functions) - (setq subject (message-strip-subject-re subject)))) - (when (and (memq 'message-strip-subject-trailing-was functions) - message-subject-trailing-was-query) - (setq subject (message-strip-subject-trailing-was subject))) - (when (memq 'message-strip-subject-encoded-words functions) - (setq subject (message-strip-subject-encoded-words subject))) - subject) + "Return simplified SUBJECT. +Do so by calling each one-argument function in the list of functions +specified by FUNCTIONS, if non-nil, or by the variable +`message-simplify-subject-functions' otherwise." + (dolist (fun (or functions message-simplify-subject-functions) subject) + (setq subject (funcall fun subject)))) ;;;###autoload (defun message-reply (&optional to-address wide switch-function) --=-=-= Content-Type: text/plain Gnus v5.13 GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian --=-=-=--