GNU bug report logs - #33224
`message-simplify-subject' simplification (and extensibility)

Previous Next

Packages: gnus, emacs;

Reported by: "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>

Date: Thu, 1 Nov 2018 06:22:02 UTC

Severity: wishlist

Tags: fixed, patch

Found in version 5.13

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33224 in the body.
You can then email your comments to 33224 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33224; Package emacs,gnus. (Thu, 01 Nov 2018 06:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org. (Thu, 01 Nov 2018 06:22:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>
To: submit <at> debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)
Subject: `message-simplify-subject' simplification (and extensibility)
Date: Thu, 01 Nov 2018 07:21:13 +0100
[Message part 1 (text/plain, inline)]
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
<Bug#33200>).

This is my second patch, please tell-me if there’s a problem anywhere.
Not sure if I know how to make patch properly, nor to report bugs
properly.

[message-simplify-subject.patch (text/x-diff, inline)]
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)
[Message part 3 (text/plain, inline)]
Gnus v5.13
GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-15, modified by Debian

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33224; Package emacs,gnus. (Mon, 13 May 2019 20:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 33224 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>
Cc: 33224 <at> debbugs.gnu.org
Subject: Re: bug#33224: `message-simplify-subject' simplification (and
 extensibility)
Date: Mon, 13 May 2019 16:36:21 -0400
"Garreau, Alexandre" <galex-713 <at> galex-713.eu> writes:

> 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
> <Bug#33200>).

I have no idea why that function was written in that strange way, and
I've applied your patch.

> This is my second patch, please tell-me if there’s a problem anywhere.
> Not sure if I know how to make patch properly, nor to report bugs
> properly.

Everything seems to work for me when testing.  As your total added lines
was less than ten, no FSF copyright assignment paperwork is needed, but
if you intend on contributing further, it might be nice to start that
process now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 May 2019 20:37:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 33224 <at> debbugs.gnu.org and "Garreau\, Alexandre" <galex-713 <at> galex-713.eu> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 May 2019 20:37:05 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 11 Jun 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 292 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.