all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Garreau\, Alexandre" <galex-713@galex-713.eu>
To: 33224@debbugs.gnu.org
Subject: bug#33224: `message-simplify-subject' simplification (and extensibility)
Date: Thu, 01 Nov 2018 07:21:13 +0100	[thread overview]
Message-ID: <87zhutmi7a.fsf@portable.galex-713.eu> (raw)

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: message-simplify-subject.patch --]
[-- Type: text/x-diff, Size: 2049 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 106 bytes --]


Gnus v5.13
GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-15, modified by Debian

             reply	other threads:[~2018-11-01  6:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01  6:21 Garreau, Alexandre [this message]
2019-05-13 20:36 ` bug#33224: `message-simplify-subject' simplification (and extensibility) Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zhutmi7a.fsf@portable.galex-713.eu \
    --to=galex-713@galex-713.eu \
    --cc=33224@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.