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

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

[elpa] externals/transient 4f80a8999c 113/366: transient--goto-argument-


From: Jonas Bernoulli
Subject: [elpa] externals/transient 4f80a8999c 113/366: transient--goto-argument-description: Handle -- special case
Date: Tue, 25 Jan 2022 18:54:32 -0500 (EST)

branch: externals/transient
commit 4f80a8999caf470e9a67f8af7f4d9bffcaf77957
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    transient--goto-argument-description: Handle -- special case
---
 lisp/transient.el | 57 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index f844e843d6..4ef004a4ba 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2813,33 +2813,36 @@ location."
         ;; for options such as "--mainline parent-number"
         (others "-\\(?:. \\|-[^[:space:]]+ \\)?[^[:space:]]+"))
     (when (re-search-forward
-           ;; Should start with whitespace and may have
-           ;; any number of options before and/or after.
-           (format
-            "^[\t\s]+\\(?:%s, \\)*?\\(?1:%s\\)%s\\(?:, %s\\)*$"
-            others
-            ;; Options don't necessarily end in an "="
-            ;; (e.g., "--gpg-sign[=<keyid>]")
-            (string-remove-suffix "=" arg)
-            ;; Simple options don't end in an "=".  Splitting this
-            ;; into 2 cases should make getting false positives
-            ;; less likely.
-            (if (string-suffix-p "=" arg)
-                ;; "[^[:space:]]*[^.[:space:]]" matches the option
-                ;; value, which is usually after the option name
-                ;; and either '=' or '[='.  The value can't end in
-                ;; a period, as that means it's being used at the
-                ;; end of a sentence.  The space is for options
-                ;; such as '--mainline parent-number'.
-                "\\(?: \\|\\[?=\\)[^[:space:]]*[^.[:space:]]"
-              ;; Either this doesn't match anything (e.g., "-a"),
-              ;; or the option is followed by a value delimited
-              ;; by a "[", "<", or ":".  A space might appear
-              ;; before this value, as in "-f <file>".  The
-              ;; space alternative is for options such as
-              ;; "-m parent-number".
-              "\\(?:\\(?: \\| ?[\\[<:]\\)[^[:space:]]*[^.[:space:]]\\)?")
-            others)
+           (if (equal arg "--")
+               ;; Special case.
+               "^[\t\s]+\\(--\\(?: \\|$\\)\\|\\[--\\]\\)"
+             ;; Should start with whitespace and may have
+             ;; any number of options before and/or after.
+             (format
+              "^[\t\s]+\\(?:%s, \\)*?\\(?1:%s\\)%s\\(?:, %s\\)*$"
+              others
+              ;; Options don't necessarily end in an "="
+              ;; (e.g., "--gpg-sign[=<keyid>]")
+              (string-remove-suffix "=" arg)
+              ;; Simple options don't end in an "=".  Splitting this
+              ;; into 2 cases should make getting false positives
+              ;; less likely.
+              (if (string-suffix-p "=" arg)
+                  ;; "[^[:space:]]*[^.[:space:]]" matches the option
+                  ;; value, which is usually after the option name
+                  ;; and either '=' or '[='.  The value can't end in
+                  ;; a period, as that means it's being used at the
+                  ;; end of a sentence.  The space is for options
+                  ;; such as '--mainline parent-number'.
+                  "\\(?: \\|\\[?=\\)[^[:space:]]*[^.[:space:]]"
+                ;; Either this doesn't match anything (e.g., "-a"),
+                ;; or the option is followed by a value delimited
+                ;; by a "[", "<", or ":".  A space might appear
+                ;; before this value, as in "-f <file>".  The
+                ;; space alternative is for options such as
+                ;; "-m parent-number".
+                "\\(?:\\(?: \\| ?[\\[<:]\\)[^[:space:]]*[^.[:space:]]\\)?")
+              others))
            nil t)
       (goto-char (match-beginning 1)))))
 



reply via email to

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