branch: elpa/casual
commit 4c0cebbb706fdff80229711666c2142d5c0231b2
Author: Charles Choi <[email protected]>
Commit: Charles Choi <[email protected]>

    Add rename commands for a file or buffer
    
    - Add the following commands to the menu `casual-editkit-open-tmenu`
      - `rename-visited-file`
      - `rename-buffer`
      - `rename-uniquely`
---
 docs/editkit.org                               |   2 +-
 docs/images/casual-editkit-open-screenshot.png | Bin 158382 -> 170624 bytes
 lisp/casual-editkit-utils.el                   |   7 +++++++
 tests/test-casual-editkit-utils.el             |   6 +++++-
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/docs/editkit.org b/docs/editkit.org
index f8a9dcfb51..52bbf01eec 100644
--- a/docs/editkit.org
+++ b/docs/editkit.org
@@ -128,7 +128,7 @@ Operations related to search and replace are captured by 
this menu. Note that th
 [[file:images/casual-editkit-search-screenshot.png]]
 
 ** Open commands (~casual-editkit-open-tmenu~)
-Commands related to opening a file (either for writing or read-only) are 
supported here. The *Project* sub-menu is also offered here.
+Commands related to opening a file (either for writing or read-only) are 
supported here. Included are commands for visiting and renaming a file or 
buffer. The *Project* sub-menu is also offered here.
 
 [[file:images/casual-editkit-open-screenshot.png]]
 
diff --git a/docs/images/casual-editkit-open-screenshot.png 
b/docs/images/casual-editkit-open-screenshot.png
index 23cc9e8aef..d6d1773808 100644
Binary files a/docs/images/casual-editkit-open-screenshot.png and 
b/docs/images/casual-editkit-open-screenshot.png differ
diff --git a/lisp/casual-editkit-utils.el b/lisp/casual-editkit-utils.el
index 59014f5ac9..2c4687a182 100644
--- a/lisp/casual-editkit-utils.el
+++ b/lisp/casual-editkit-utils.el
@@ -136,6 +136,13 @@ also available from here."
     ("V" "Visit other…" find-file-read-only-other-window)
     ("M-v" "Visit in frame…" find-file-read-only-other-frame)]
 
+   ["Rename"
+    :pad-keys t
+    ("r" "File…" rename-visited-file
+     :inapt-if-not buffer-file-name)
+    ("R" "Buffer…" rename-buffer)
+    ("M-r" "Buffer Uniquely" rename-uniquely)]
+
    ["Project"
     ("p" "Project›" casual-editkit-project-tmenu)]]
 
diff --git a/tests/test-casual-editkit-utils.el 
b/tests/test-casual-editkit-utils.el
index 364577b6e0..41c83f57ba 100644
--- a/tests/test-casual-editkit-utils.el
+++ b/tests/test-casual-editkit-utils.el
@@ -31,8 +31,9 @@
   (let ((tmpfile "casual-editkit-open-tmenu.txt"))
     (casualt-editkit-setup tmpfile)
 
-    (cl-letf (;;((symbol-function #') (lambda () t))
+    (cl-letf (;; ((symbol-function #'buffer-file-name) (lambda () t))
               (casualt-mock #'find-file)
+              (casualt-mock #'rename-visited-file)
               (casualt-mock #'find-file-other-window)
               (casualt-mock #'find-file-other-frame)
               (casualt-mock #'find-alternate-file)
@@ -41,6 +42,9 @@
 
       (let ((test-vectors
              '((:binding "f" :command find-file)
+               (:binding "r" :command rename-visited-file)
+               (:binding "R" :command rename-buffer)
+               (:binding "M-r" :command rename-uniquely)
                (:binding "F" :command find-file-other-window)
                (:binding "M-n" :command find-file-other-frame)
                (:binding "a" :command find-alternate-file)

Reply via email to