[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 363e5acffe 5/8: magit-thingatpt--git-revision:
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 363e5acffe 5/8: magit-thingatpt--git-revision: Trim parentheses and punctuation |
Date: |
Tue, 5 Sep 2023 21:59:36 -0400 (EDT) |
branch: elpa/git-commit
commit 363e5acffed27b945a0a2a6e4faf6eaf705c3ec8
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-thingatpt--git-revision: Trim parentheses and punctuation
Because we want to match in arbitrary buffers and the format of refs
is actually pretty permissive, we tend to overmatch, and then have to
cleanup the intermediate result.
---
lisp/magit-git.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 2c9679df65..3e5987e0b7 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2563,7 +2563,15 @@ and this option only controls what face is used.")
(lambda ()
(re-search-forward (format "\\=[^%s]*" c) nil
t))))
(bounds-of-thing-at-point 'git-revision))))
- (string (buffer-substring-no-properties (car bounds) (cdr
bounds))))
+ (string (buffer-substring-no-properties (car bounds) (cdr
bounds)))
+ ;; References are allowed to contain most parentheses and
+ ;; most punctuation, but if those characters appear at the
+ ;; edges of a possible reference in arbitrary text, then
+ ;; they are much more likely to be intended as just that:
+ ;; punctuation and delimiters.
+ (string (thread-first string
+ (string-trim-left "[(</]")
+ (string-trim-right "[])>/.,;!]"))))
(and (or (and (>= (length string) 7)
(string-match-p "[a-z]" string)
(magit-commit-p string))
- [nongnu] elpa/git-commit updated (a3b9b00702 -> 27099441a0), ELPA Syncer, 2023/09/05
- [nongnu] elpa/git-commit 4a701c1bdc 3/8: magit-split-range: Handle edge-cases, ELPA Syncer, 2023/09/05
- [nongnu] elpa/git-commit 363e5acffe 5/8: magit-thingatpt--git-revision: Trim parentheses and punctuation,
ELPA Syncer <=
- [nongnu] elpa/git-commit 728685f7be 2/8: magit-read-range-or-commit: Cosmetics, ELPA Syncer, 2023/09/05
- [nongnu] elpa/git-commit 88f4b93b10 1/8: magit-patch-create: Improve a prompt, ELPA Syncer, 2023/09/05
- [nongnu] elpa/git-commit 8220f94b82 4/8: magit-hash-range: Properly validate, ELPA Syncer, 2023/09/05
- [nongnu] elpa/git-commit ec95f00b1b 6/8: magit-thingatpt--git-revision: Filter out some mismatches, ELPA Syncer, 2023/09/05
- [nongnu] elpa/git-commit a3b7cdc486 7/8: git-revision-range: New thing-at-point type, ELPA Syncer, 2023/09/05
- [nongnu] elpa/git-commit 27099441a0 8/8: Offer textual range at point as next history element, ELPA Syncer, 2023/09/05