Slight readability improvement.  Also got rid of the `save-match-data'
overhead, as `substring' doesn't alter the match data anyway.

Signed-off-by: Pieter Praet <[email protected]>
---
 magit.el | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/magit.el b/magit.el
index 23a63d4..51be70a 100644
--- a/magit.el
+++ b/magit.el
@@ -2536,17 +2536,13 @@ (defun magit-process-filter (proc string)
 (defun magit-process-yes-or-no-prompt (proc string)
   (let ((beg (string-match magit-process-yes-or-no-prompt-regexp string)))
     (when beg
-      (process-send-string
-       proc
-       (concat (downcase
-                (match-string (if (let ((max-mini-window-height 30))
-                                    (yes-or-no-p
-                                     (save-match-data
-                                       (substring string 0 beg))))
-                                  1
-                                2)
-                              string))
-               "\n")))))
+      (let* ((max-mini-window-height 30)
+             (answer (yes-or-no-p (substring string 0 beg)))
+             (reply (concat
+                     (downcase
+                      (match-string (if answer 1 2) string))
+                     "\n")))
+        (process-send-string proc reply)))))
 
 (defun magit-process-password-prompt (proc string)
   "Forward password prompts to the user."
-- 
1.7.11.1

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to