branch: elpa/casual
commit 715e35e45b797a5268eeb049836cde93d5ce4ca6
Merge: 1bdc8fe886 8848d2b6d1
Author: Charles Choi <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #216 from kickingvegas/195-add-write-region-to-editkit
Add write-region and write-file commands to EditKit
---
docs/images/casual-editkit-main-screenshot.png | Bin 228117 -> 295134 bytes
lisp/casual-editkit.el | 6 +++++-
tests/test-casual-editkit.el | 7 ++++++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/docs/images/casual-editkit-main-screenshot.png
b/docs/images/casual-editkit-main-screenshot.png
index 42cb971bfb..fb5d9e948d 100644
Binary files a/docs/images/casual-editkit-main-screenshot.png and
b/docs/images/casual-editkit-main-screenshot.png differ
diff --git a/lisp/casual-editkit.el b/lisp/casual-editkit.el
index 6487f4df17..fdd934a1cc 100644
--- a/lisp/casual-editkit.el
+++ b/lisp/casual-editkit.el
@@ -57,7 +57,11 @@ user-customized menu."
:inapt-if-not buffer-modified-p
:if-not (lambda () buffer-read-only))
("s" "Save" save-buffer
- :if-not (lambda () buffer-read-only))]
+ :if-not (lambda () buffer-read-only))
+ ("S" "Save as…" write-file
+ :if-not (lambda () buffer-read-only))
+ ("y" "Write region…" write-region
+ :if use-region-p)]
["Edit"
:pad-keys t
diff --git a/tests/test-casual-editkit.el b/tests/test-casual-editkit.el
index d6417df292..a6818f3f5f 100644
--- a/tests/test-casual-editkit.el
+++ b/tests/test-casual-editkit.el
@@ -41,7 +41,9 @@
(casualt-mock #'recentf-open-files)
(casualt-mock #'revert-buffer)
(casualt-mock #'save-buffer)
+ (casualt-mock #'write-file)
(casualt-mock #'widen)
+ (casualt-mock #'write-region)
(casualt-mock #'insert-char)
(casualt-mock #'fill-paragraph)
@@ -49,7 +51,7 @@
(casualt-mock #'join-line)
(casualt-mock #'mark-sexp)
(casualt-mock #'kill-sexp)
- (casualt-mock #'transpose-sexps)
+ (casualt-mock #'transpose-sexp)
(casualt-mock #'org-agenda)
(casualt-mock #'compile)
@@ -69,6 +71,8 @@
(:binding "R" :command recentf-open-files)
(:binding "v" :command revert-buffer)
(:binding "s" :command save-buffer)
+ (:binding "S" :command write-file)
+ (:binding "y" :command write-region)
(:binding "e" :command casual-editkit-edit-tmenu)
(:binding "p" :command fill-paragraph)
@@ -109,6 +113,7 @@
(:binding "x" :command save-buffers-kill-emacs))))
(insert "hello")
+ (casualt-mock-active-region)
(casualt-suffix-testcase-runner test-vectors
#'casual-editkit-main-tmenu
'(lambda () (random 5000)))