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

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

[elpa] externals/hyperbole a7a7f74859 125/143: Add i- and ebut:act funct


From: ELPA Syncer
Subject: [elpa] externals/hyperbole a7a7f74859 125/143: Add i- and ebut:act functions and tests
Date: Mon, 19 Feb 2024 15:59:26 -0500 (EST)

branch: externals/hyperbole
commit a7a7f74859d65b1317e094dec9b964077e6f229a
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: Mats Lidell <mats.lidell@lidells.se>

    Add i- and ebut:act functions and tests
---
 ChangeLog          |  9 +++++----
 hbut.el            | 17 ++++++++++++++++-
 test/hbut-tests.el | 12 +++++++++++-
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a117b19540..58c8369af7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
 2024-02-08  Mats Lidell  <matsl@gnu.org>
 
-* hbut.el (ibut:act-label): Rename ibut:act to ibut:act-label, it takes a
-    label as arg.
+* test/hbut-tests.el (hbut-tests--ebut-act-calls-hbut-act)
+    (hbut-tests--ibut-act-calls-hbut-act): Add test for new act functions.
 
 * hui-menu.el (hui-menu-explicit-buttons): Use ebut:act-label.
 
-* hbut.el (ebut:act-label): Rename ebut:act to ebut:act-label, it takes a
-    label as arg.
+* hbut.el (ibut:act-label, ebut:act-label): Rename ebut:act and ibut:act
+    since they take a label as arg.
+    (ebut:act, ibut:act): Add new act functions taking a hbut as arg.
 
 * test/hyrolo-tests.el: Make hide tests more forgiving about hiding
     section headers. Allows test cases to be used with different versions
diff --git a/hbut.el b/hbut.el
index 8c294037f6..18592c5b0d 100644
--- a/hbut.el
+++ b/hbut.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:      2-Feb-24 at 21:47:24 by Mats Lidell
+;; Last-Mod:      2-Feb-24 at 22:11:13 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -122,6 +122,14 @@ indicating the source of any of its Hyperbole buttons.")
   "*Non-nil value saves button data when button source is saved.
 Nil disables saving.")
 
+(defun    ebut:act (&optional hbut)
+  "Perform action for optional explicit Hyperbole button symbol HBUT.
+Default is the symbol hbut:current."
+  (interactive (list (hbut:get (hargs:read-match "Activate labeled Hyperbole 
button: "
+                                                (ebut:alist)
+                                                nil t nil 'hbut))))
+  (hbut:act hbut))
+
 (defun    ebut:act-label (label)
   "Activate Hyperbole explicit button with LABEL from the current buffer."
   (interactive (list (hargs:read-match "Activate explicit button labeled: "
@@ -1692,6 +1700,13 @@ Keys in optional KEY-SRC or the current buffer."
 ;;; ibut class - Implicit Hyperbole Buttons
 ;;; ========================================================================
 
+(defun    ibut:act (&optional hbut)
+  "Perform action for optional implicit Hyperbole button symbol HBUT.
+Default is the symbol hbut:current."
+  (interactive (list (hbut:get (hargs:read-match "Activate labeled Hyperbole 
button: "
+                                                (ibut:alist)
+                                                nil t nil 'hbut))))
+  (hbut:act hbut))
 
 (defun    ibut:act-label (label)
   "Activate Hyperbole implicit button with <[LABEL]> from the current buffer."
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index 80d34eb95f..09ab17d3cf 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-may-21 at 09:33:00
-;; Last-Mod:     20-Jan-24 at 15:43:50 by Mats Lidell
+;; Last-Mod:      2-Feb-24 at 22:16:49 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -738,6 +738,16 @@ See #10 for the proper way to add an ibutton name.
       (hbut-tests:should-match-tmp-folder buf-str)
       (should (null (hattr:get 'hbut:current 'name))))))
 
+(ert-deftest hbut-tests--ebut-act-calls-hbut-act ()
+  "Verify `ebut:act' calls `hbut:act'."
+  (mocklet (((hbut:act 'button) => t))
+    (should (ebut:act 'button))))
+
+(ert-deftest hbut-tests--ibut-act-calls-hbut-act ()
+  "Verify `ibut:act' calls `hbut:act'."
+  (mocklet (((hbut:act 'button) => t))
+    (should (ibut:act 'button))))
+
 ;; This file can't be byte-compiled without the `el-mock' package (because of
 ;; the use of the `with-mock' macro), which is not a dependency of Hyperbole.
 ;;  Local Variables:



reply via email to

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