branch: externals/hyperbole
commit 1752acb9d09cab0eae2458c9dbea923b4117e4f9
Author: Mats Lidell <[email protected]>
Commit: Mats Lidell <[email protected]>
Use prefix arg for interactive call
---
hui.el | 10 +++++-----
test/hui-tests.el | 14 +++++---------
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/hui.el b/hui.el
index 3ab5468ab4..e038f89b51 100644
--- a/hui.el
+++ b/hui.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Sep-91 at 21:42:03
-;; Last-Mod: 5-Jan-25 at 12:24:47 by Bob Weiner
+;; Last-Mod: 11-Jan-25 at 23:39:13 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -134,7 +134,7 @@ point; see `hui:delimited-selectable-thing'."
;; to allow killing kcell references, active regions and delimited
;; areas (like sexpressions).
;;;###autoload
-(defun hui-kill-region (&optional beg end)
+(defun hui-kill-region (&optional beg end interactive)
"Kill between point and mark.
The text is deleted but saved in the kill ring.
The command \\[yank] can retrieve it from there.
@@ -148,18 +148,18 @@ If the previous command was also a kill command,
the text killed this time appends to the text killed last time
to make one entry in the kill ring.
Patched to remove the most recent completion."
- (interactive "r")
+ (interactive "r\np")
(cond ((eq last-command 'complete)
(hui:kill-region beg end))
((or (use-region-p)
(null transient-mark-mode)
- (not (called-interactively-p 'interactive)))
+ (not interactive))
(unless (and beg end)
(setq beg (region-beginning)
end (region-end)))
(hui:kill-region beg end))
(t (when (or (not (and beg end))
- (called-interactively-p 'interactive))
+ interactive)
(cond ((hui-select-delimited-thing)
(setq beg (region-beginning)
end (region-end)))
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 6d8947ac82..9998216a12 100644
--- a/test/hui-tests.el
+++ b/test/hui-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <[email protected]>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
-;; Last-Mod: 11-Jan-25 at 01:10:02 by Mats Lidell
+;; Last-Mod: 11-Jan-25 at 23:40:55 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -1184,8 +1184,7 @@ With point on label suggest that ibut for rename."
(set-mark (point))
(goto-char 4)
- (mocklet ((called-interactively-p => t))
- (funcall-interactively 'hui-kill-region (region-beginning)
(region-end)))
+ (call-interactively #'hui-kill-region)
(should (string= "{def}ghi" (buffer-string)))
(erase-buffer)
@@ -1194,8 +1193,7 @@ With point on label suggest that ibut for rename."
(set-mark (point))
(goto-char 4)
(deactivate-mark)
- (mocklet ((called-interactively-p => t))
- (funcall-interactively 'hui-kill-region (region-beginning)
(region-end)))
+ (call-interactively #'hui-kill-region)
(should (string= "abcghi" (buffer-string)))
(erase-buffer)
@@ -1204,8 +1202,7 @@ With point on label suggest that ibut for rename."
(set-mark (point))
(goto-char 5)
(deactivate-mark)
- (mocklet ((called-interactively-p => t))
- (funcall-interactively 'hui-kill-region (region-beginning)
(region-end)))
+ (call-interactively #'hui-kill-region)
(should (string= "def}ghi" (buffer-string))))
(let ((transient-mark-mode nil))
@@ -1215,8 +1212,7 @@ With point on label suggest that ibut for rename."
(set-mark (point))
(goto-char 4)
(deactivate-mark)
- (mocklet ((called-interactively-p => t))
- (funcall-interactively 'hui-kill-region (region-beginning)
(region-end)))
+ (call-interactively #'hui-kill-region)
(should (string= "{def}ghi" (buffer-string))))))
;; This file can't be byte-compiled without `with-simulated-input' which