[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole f423dd3163 4/9: Refactor to have base behavio
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole f423dd3163 4/9: Refactor to have base behavior as kill-region |
Date: |
Sun, 19 Jan 2025 12:58:14 -0500 (EST) |
branch: externals/hyperbole
commit f423dd31638d723bccc301c1e7c56369ec547106
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: Mats Lidell <mats.lidell@lidells.se>
Refactor to have base behavior as kill-region
---
hui.el | 25 ++++++++++++-------------
test/hui-tests.el | 32 +++++++++++++++++++++++++++++---
2 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/hui.el b/hui.el
index e038f89b51..18c6331bf6 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: 11-Jan-25 at 23:39:13 by Mats Lidell
+;; Last-Mod: 13-Jan-25 at 00:57:43 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -133,6 +133,7 @@ point; see `hui:delimited-selectable-thing'."
;; either "completion.el" or "simple.el" when hyperbole-mode is active
;; to allow killing kcell references, active regions and delimited
;; areas (like sexpressions).
+
;;;###autoload
(defun hui-kill-region (&optional beg end interactive)
"Kill between point and mark.
@@ -151,22 +152,20 @@ Patched to remove the most recent completion."
(interactive "r\np")
(cond ((eq last-command 'complete)
(hui:kill-region beg end))
- ((or (use-region-p)
- (null transient-mark-mode)
- (not interactive))
+ ((and transient-mark-mode
+ (or (use-region-p)
+ (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))
- interactive)
- (cond ((hui-select-delimited-thing)
- (setq beg (region-beginning)
- end (region-end)))
- ((let ((thing-beg-end
(hui:delimited-selectable-thing-and-bounds)))
- (when thing-beg-end
- (setq beg (nth 1 thing-beg-end)
- end (nth 2 thing-beg-end)))))))
+ (t (cond ((hui-select-delimited-thing)
+ (setq beg (region-beginning)
+ end (region-end)))
+ ((let ((thing-beg-end
(hui:delimited-selectable-thing-and-bounds)))
+ (when thing-beg-end
+ (setq beg (nth 1 thing-beg-end)
+ end (nth 2 thing-beg-end))))))
(when (and beg end)
(hui:kill-region beg end)))))
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 9998216a12..4ae6b1fb1f 100644
--- a/test/hui-tests.el
+++ b/test/hui-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
-;; Last-Mod: 11-Jan-25 at 23:40:55 by Mats Lidell
+;; Last-Mod: 13-Jan-25 at 00:58:15 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -1180,7 +1180,7 @@ With point on label suggest that ibut for rename."
(goto-char 1)
;; No mark set
- (should-error (hui-kill-region) :type 'error)
+ (should-error (call-interactively #'hui-kill-region) :type 'error)
(set-mark (point))
(goto-char 4)
@@ -1206,14 +1206,40 @@ With point on label suggest that ibut for rename."
(should (string= "def}ghi" (buffer-string))))
(let ((transient-mark-mode nil))
+ (erase-buffer)
+ (insert "abc{def}ghi")
+ (goto-char 1)
+ (set-mark nil)
+
+ ;; No mark set
+ (should-error (call-interactively #'hui-kill-region) :type 'error)
+
(erase-buffer)
(insert "abc{def}ghi")
(goto-char 1)
(set-mark (point))
(goto-char 4)
+ (activate-mark)
+ (call-interactively #'hui-kill-region)
+ (should (string= "{def}ghi" (buffer-string)))
+
+ (erase-buffer)
+ (insert "abc{def}ghi")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (deactivate-mark)
+ (call-interactively #'hui-kill-region)
+ (should (string= "abcghi" (buffer-string)))
+
+ (erase-buffer)
+ (insert "abc{def}ghi")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 5)
(deactivate-mark)
(call-interactively #'hui-kill-region)
- (should (string= "{def}ghi" (buffer-string))))))
+ (should (string= "def}ghi" (buffer-string))))))
;; This file can't be byte-compiled without `with-simulated-input' which
;; is not part of the actual dependencies, so:
- [elpa] externals/hyperbole updated (cbbf963a9f -> bb7909e5d6), ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 1752acb9d0 3/9: Use prefix arg for interactive call, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 99ae350431 2/9: Refactored and simplified, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 8133ed63eb 1/9: Add test for hui-kill-region, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole a7ba7d86ea 5/9: Fix non-interactive behavior, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 436eb33439 6/9: Add test for consecutive calls to hui-kill-region, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole f423dd3163 4/9: Refactor to have base behavior as kill-region,
ELPA Syncer <=
- [elpa] externals/hyperbole 30daecc280 8/9: Merge branch 'master' into add-test-for-c-w-use-prefix-arg, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole bb7909e5d6 9/9: Merge pull request #646 from rswgnu/add-test-for-c-w-use-prefix-arg, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 17a3d87b6e 7/9: Avoid prior tests kill commands to affect kill ring, ELPA Syncer, 2025/01/19