branch: elpa/casual
commit 4753a54e00d4ee91998af7d98bc473e3d4045ad9
Merge: a2e33772a0 aa0451af93
Author: Charles Choi <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #80 from 
kickingvegas/77-add-revert-buffer-command-to-editkit-open-menu
    
    Add revert-buffer to Casual EditKit
---
 docs/images/casual-editkit-main-screenshot.png | Bin 340579 -> 289943 bytes
 lisp/casual-editkit-utils.el                   |   3 ++-
 lisp/casual-editkit.el                         |   6 +++++-
 tests/test-casual-editkit.el                   |   8 +++++++-
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/docs/images/casual-editkit-main-screenshot.png 
b/docs/images/casual-editkit-main-screenshot.png
index ffd223c835..26fa834797 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-utils.el b/lisp/casual-editkit-utils.el
index 6a4bbe6fb3..af324ad975 100644
--- a/lisp/casual-editkit-utils.el
+++ b/lisp/casual-editkit-utils.el
@@ -195,7 +195,8 @@ Commands pertaining to editing operations can be accessed 
here."
     ("c" "Copy›" casual-editkit-copy-tmenu)
     ("k" "Kill (Cut)›" casual-editkit-kill-tmenu
      :if-not casual-editkit-buffer-read-only-p)
-    ("y" "Yank (Paste)" yank)]
+    ("y" "Yank (Paste)" yank
+    :if-not (lambda () buffer-read-only))]
 
    [("t" "Transpose›" casual-editkit-transpose-tmenu
      :if-not casual-editkit-buffer-read-only-p)
diff --git a/lisp/casual-editkit.el b/lisp/casual-editkit.el
index 9a6048aed9..266ca306d2 100644
--- a/lisp/casual-editkit.el
+++ b/lisp/casual-editkit.el
@@ -54,7 +54,11 @@ user-customized menu."
      :if (lambda () (buffer-file-name)))
     ("b" "List Buffers" ibuffer)
     ("R" "Recent Files" recentf-open-files)
-    ("s" "Save" save-buffer)]
+    ("v" "Revert…" revert-buffer
+     :inapt-if-not buffer-modified-p
+     :if-not (lambda () buffer-read-only))
+    ("s" "Save" save-buffer
+     :if-not (lambda () buffer-read-only))]
 
    ["Edit"
     :pad-keys t
diff --git a/tests/test-casual-editkit.el b/tests/test-casual-editkit.el
index a25a96d937..909dcd3c56 100644
--- a/tests/test-casual-editkit.el
+++ b/tests/test-casual-editkit.el
@@ -38,6 +38,7 @@
               (casualt-mock #'dired-jump-other-window)
               (casualt-mock #'ibuffer)
               (casualt-mock #'recentf-open-files)
+              (casualt-mock #'revert-buffer)
               (casualt-mock #'save-buffer)
 
               (casualt-mock #'insert-char)
@@ -58,6 +59,7 @@
                (:binding "d" :command dired-jump-other-window)
                (:binding "b" :command ibuffer)
                (:binding "R" :command recentf-open-files)
+               (:binding "v" :command revert-buffer)
                (:binding "s" :command save-buffer)
 
                (:binding "e" :command casual-editkit-edit-tmenu)
@@ -91,9 +93,13 @@
                (:binding "," :command casual-editkit-settings-tmenu)
                (:binding "x" :command save-buffers-kill-emacs))))
 
+
+        (insert "hello")
         (casualt-suffix-testcase-runner test-vectors
                                         #'casual-editkit-main-tmenu
-                                        '(lambda () (random 5000)))))
+                                        '(lambda () (random 5000)))
+        (save-buffer)))
+
     (casualt-editkit-breakdown tmpfile)))
 
 (provide 'test-casual-editkit)

Reply via email to