-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for hui-kill-region with the Emacs default settings (#664)
- Loading branch information
Showing
2 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
2025-02-02 Mats Lidell <[email protected]> | ||
|
||
* test/hui-tests.el (hui--kill-highlighted-region-default-settings): Add test for hui-kill-region | ||
with the default settings for transient-mark-mode and mark-even-if-inactive. | ||
|
||
2025-02-02 Bob Weiner <[email protected]> | ||
|
||
* hywiki.el (hywiki-buttonize-non-character-commands): Simplify to improve | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
;; Author: Mats Lidell <[email protected]> | ||
;; | ||
;; Orig-Date: 30-Jan-21 at 12:00:00 | ||
;; Last-Mod: 2-Feb-25 at 11:50:31 by Bob Weiner | ||
;; Last-Mod: 2-Feb-25 at 22:19:25 by Mats Lidell | ||
;; | ||
;; SPDX-License-Identifier: GPL-3.0-or-later | ||
;; | ||
|
@@ -1173,6 +1173,78 @@ With point on label suggest that ibut for rename." | |
(gbut:act "global")) | ||
(hy-delete-file-and-buffer global-but-file)))) | ||
|
||
(ert-deftest hui--kill-highlighted-region-default-settings () | ||
"Verify `hui-kill-region'. | ||
The Emacs default settings are used, i.e. both `transient-mark-mode' and | ||
`mark-even-if-inactive' are enabled." | ||
(with-temp-buffer | ||
(let ((transient-mark-mode t) | ||
(mark-even-if-inactive t)) | ||
(insert "abc{def}ghi") | ||
(goto-char 1) | ||
(set-mark nil) | ||
|
||
;; No mark set | ||
(condition-case err | ||
(call-interactively #'hui-kill-region) | ||
(error | ||
(progn | ||
(should (memq (car err) (list 'error 'user-error))) | ||
(should (string-match "The mark is not set now, so there is no region" (cadr err)))))) | ||
|
||
(set-mark (point)) | ||
(goto-char 4) | ||
(call-interactively #'hui-kill-region) | ||
(should (string= "{def}ghi" (buffer-string))) | ||
|
||
(erase-buffer) | ||
(insert "abc{def}hig") | ||
(goto-char 1) | ||
(set-mark (point)) | ||
(goto-char 4) | ||
(deactivate-mark) | ||
(call-interactively #'hui-kill-region) | ||
(should (string= "abchig" (buffer-string))) | ||
|
||
(erase-buffer) | ||
(insert "abc{def}igh") | ||
(goto-char 1) | ||
(set-mark (point)) | ||
(goto-char 4) | ||
(activate-mark) | ||
(call-interactively #'hui-kill-region) | ||
(should (string= "{def}igh" (buffer-string))) | ||
|
||
(erase-buffer) | ||
(insert "bca{def}ghi") | ||
(goto-char 1) | ||
(set-mark (point)) | ||
(goto-char 5) | ||
(deactivate-mark) | ||
(call-interactively #'hui-kill-region) | ||
(should (string= "def}ghi" (buffer-string))) | ||
|
||
;; Not interactive | ||
(erase-buffer) | ||
(insert "cab{efd}ghi") | ||
(goto-char 1) | ||
(set-mark (point)) | ||
(goto-char 4) | ||
(activate-mark) | ||
(hui-kill-region (mark t) (point)) | ||
(should (string= "{efd}ghi" (buffer-string))) | ||
|
||
;; Pick up region if beg or end is not set. | ||
(erase-buffer) | ||
(insert "bac{def}ghi") | ||
(goto-char 1) | ||
(set-mark (point)) | ||
(goto-char 4) | ||
(deactivate-mark) | ||
(hui-kill-region nil nil) | ||
(should (string= "{def}ghi" (buffer-string)))))) | ||
|
||
|
||
(ert-deftest hui--kill-highlighted-region () | ||
"Verify `hui-kill-region'. | ||
`transient-mark-mode' is enabled and `mark-even-if-inactive' is | ||
|