emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/vc-got eacbf76 065/145: don't hardcode got questions


From: ELPA Syncer
Subject: [elpa] externals/vc-got eacbf76 065/145: don't hardcode got questions
Date: Thu, 9 Sep 2021 15:58:34 -0400 (EDT)

branch: externals/vc-got
commit eacbf767c64ccb8c469698044c691c7baa3b20a4
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>

    don't hardcode got questions
    
    match and relay them to the user
---
 vc-got-stage.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/vc-got-stage.el b/vc-got-stage.el
index baf0e43..489c18f 100644
--- a/vc-got-stage.el
+++ b/vc-got-stage.el
@@ -25,6 +25,7 @@
 
 ;;; Code:
 
+(require 'rx)
 (require 'vc)
 
 (defvar vc-got-program)                 ;vc-got.el
@@ -86,11 +87,12 @@ PROC is the process, STRING part of its output."
           (insert string)
           (save-excursion
             (beginning-of-line)
-            (let ((msg (cond ((looking-at "^stage this change?")
-                              "Stage this change? ")
-                             ((looking-at "^stage this addition?")
-                              "Stage this addition? "))))
-              (when msg
+            (when (looking-at (rx bol
+                                  (group (zero-or-one "un")
+                                         "stage"
+                                         (zero-or-more anychar)
+                                         "?")))
+              (let ((msg (match-string 1)))
                 (kill-line)
                 (process-send-string buf (if (y-or-n-p msg) "y\n" "n\n"))
                 (erase-buffer)))))))))



reply via email to

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