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

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

[elpa] externals/hyperbole 64579b0 30/50: Fix defil with function improp


From: Stefan Monnier
Subject: [elpa] externals/hyperbole 64579b0 30/50: Fix defil with function improper call to regexp-quote
Date: Wed, 17 Mar 2021 18:44:19 -0400 (EDT)

branch: externals/hyperbole
commit 64579b0e1731687b0e5196ccc25937c6114e39bb
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Fix defil with function improper call to regexp-quote
    
    Also add label flash of git-commit-references ibuttons.
---
 Changes       |  6 ++++++
 hbut.el       | 14 ++++++++------
 hib-social.el | 10 ++++++----
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/Changes b/Changes
index 74f58da..bdfeb19 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+2021-02-15  Bob Weiner  <rsw@gnu.org>
+
+* hbut.el (defil): Fixed improper call of regexp-quote when link-expr was not 
a string.
+
+* hib-social.el (git-commit-reference): Added flash of button label
+
 2021-02-14  Bob Weiner  <rsw@gnu.org>
 
 * man/hyperbole.texi (Programmatic Button Creation): Documented ebut:program.
diff --git a/hbut.el b/hbut.el
index 2fecc1b..935836c 100644
--- a/hbut.el
+++ b/hbut.el
@@ -1730,7 +1730,7 @@ type for ibtype is presently undefined."
            [&optional stringp]   ; Match the doc string, if present.
            def-body))
 
-(defun ibtype:activate-link-path (referent)
+(defun ibtype:activate-link (referent)
   "Activate a Hyperbole implicit link `referent', either a key series, a URL 
or a path."
   (when referent
     (let ((key-series (kbd-key:is-p referent)))
@@ -1800,18 +1800,20 @@ commit changes."
             (when button-text
               (if (or (functionp ,link-expr) (subrp ,link-expr))
                   (hact ,link-expr button-text)
-                (let ((path-to-display (when (and button-text (string-match 
,text-regexp button-text))
-                                         (replace-match ,link-expr nil nil 
button-text))))
-                  (ibtype:activate-link-path path-to-display))))))
+                (let ((referent (when (and button-text (stringp ,link-expr)
+                                           (string-match ,text-regexp 
button-text))
+                                  (replace-match ,link-expr nil nil 
button-text))))
+                  (ibtype:activate-link referent))))))
        (put (intern (format "ibtypes::%s" ',type))
            'function-documentation
            (or ,doc
                (format "%s - %s\n\n%s %s%s%s\n%s %s" ',type "Hyperbole 
implicit button type"
                        "  Recognizes buttons of the form:\n    "
                        (if ,start-regexp-flag (regexp-quote ,start-delim) 
,start-delim)
-                       (regexp-quote ,text-regexp)
+                       ,text-regexp
                        (if ,end-regexp-flag (regexp-quote ,end-delim) 
,end-delim)
-                       "  which display links of the form:\n    " 
(regexp-quote ,link-expr)))))))
+                       "  which display links with:\n    "
+                       (if (stringp ,link-expr) (regexp-quote ,link-expr) 
,link-expr)))))))
 
 (defmacro defal (type link-expr &optional doc)
   "Create Hyperbole action button link TYPE (an unquoted symbol) whose buttons 
look like: <TYPE link-text> where link-text is substituted into LINK-EXPR as 
grouping 1 (\\\\1).
diff --git a/hib-social.el b/hib-social.el
index 0092ed0..1d32247 100644
--- a/hib-social.el
+++ b/hib-social.el
@@ -608,10 +608,12 @@ PROJECT value is provided, it defaults to the value of
 
 (defib git-commit-reference ()
   "Display the diff for a git commit reference, e.g. \"commit a55e21\", 
typically produced by git log."
-  (if (save-excursion
-       (beginning-of-line)
-       (looking-at "\\s-*commit \\([0-9a-f][0-9a-f][0-9a-f][0-9a-f]+\\)\\s-"))
-      (hact #'git-reference (match-string-no-properties 1))))
+  (when (save-excursion
+         (beginning-of-line)
+         (looking-at "\\s-*\\(commit 
\\([0-9a-f][0-9a-f][0-9a-f][0-9a-f]+\\)\\)\\s-"))
+    (save-match-data
+      (ibut:label-set (match-string-no-properties 1) (match-beginning 1) 
(match-end 1)))
+    (hact #'git-reference (match-string-no-properties 2))))
 
 (defvar hibtypes-git-repos-cache
   (expand-file-name "Local-Git-Repos" hbmap:dir-user)



reply via email to

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