emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master a77c679 2/4: message-strip-subject-trailing-was: Re


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master a77c679 2/4: message-strip-subject-trailing-was: Refactor
Date: Tue, 23 Feb 2016 03:50:14 +0000

branch: master
commit a77c6799c1f3ae30c8bbf26aa376f52c33cd554f
Author: Michal Nazarewicz <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    message-strip-subject-trailing-was: Refactor
    
    * lisp/gnus/message.el (message-strip-subject-trailing-was): Refactor
    the function replacing sequence of `if' calls with a mixture of `or'
    and `and' calls instead.  This makes it shorter and containing less
    internal state thus easier to follow.
---
 lisp/gnus/message.el |   47 ++++++++++++++++++++---------------------------
 1 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index cc147b3..a23e3ba 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2197,33 +2197,26 @@ charset: "
   "Remove trailing \"(was: <old subject>)\" from SUBJECT lines.
 Leading \"Re: \" is not stripped by this function.  Use the function
 `message-strip-subject-re' for this."
-  (let* ((query message-subject-trailing-was-query)
-        (new) (found))
-    (setq found
-         (string-match
-          (if (eq query 'ask)
-              message-subject-trailing-was-ask-regexp
-            message-subject-trailing-was-regexp)
-          subject))
-    (if found
-       (setq new (substring subject 0 (match-beginning 0))))
-    (if (or (not found) (eq query nil))
-       subject
-      (if (eq query 'ask)
-         (if (message-y-or-n-p
-              "Strip `(was: <old subject>)' in subject? " t
-              (concat
-               "Strip `(was: <old subject>)' in subject "
-               "and use the new one instead?\n\n"
-               "Current subject is:   \""
-               subject "\"\n\n"
-               "New subject would be: \""
-               new "\"\n\n"
-               "See the variable `message-subject-trailing-was-query' "
-               "to get rid of this query."
-               ))
-             new subject)
-       new))))
+  (or
+   (let ((query message-subject-trailing-was-query) new)
+     (and query
+          (string-match (if (eq query 'ask)
+                            message-subject-trailing-was-ask-regexp
+                          message-subject-trailing-was-regexp)
+                        subject)
+          (setq new (substring subject 0 (match-beginning 0)))
+          (or (not (eq query 'ask))
+              (message-y-or-n-p
+               "Strip `(was: <old subject>)' in subject? " t
+               (concat
+                "Strip `(was: <old subject>)' in subject "
+                "and use the new one instead?\n\n"
+                "Current subject is:   \"" subject "\"\n\n"
+                "New subject would be: \"" new "\"\n\n"
+                "See the variable `message-subject-trailing-was-query' "
+                "to get rid of this query.")))
+          new))
+   subject))
 
 ;;; Suggested by Jonas Steverud  @  www.dtek.chalmers.se/~d4jonas/
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]