branch: elpa/casual
commit 678b04ebf7b4c632c5a13097e39c9439fda84d2b
Merge: b3f4e370e2 52f2c36060
Author: Charles Choi <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #294 from kickingvegas/290-add-narrow-to-page-to-editkit
    
    Add narrow-to-page to EditKit
---
 docs/images/casual-editkit-narrow-screenshot.png | Bin 43711 -> 41152 bytes
 lisp/casual-editkit-utils.el                     |   7 +++++--
 tests/test-casual-editkit-utils.el               |   9 ++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/docs/images/casual-editkit-narrow-screenshot.png 
b/docs/images/casual-editkit-narrow-screenshot.png
index fa64441401..a9b8ff6088 100644
Binary files a/docs/images/casual-editkit-narrow-screenshot.png and 
b/docs/images/casual-editkit-narrow-screenshot.png differ
diff --git a/lisp/casual-editkit-utils.el b/lisp/casual-editkit-utils.el
index cba11853b5..a93e0ae027 100644
--- a/lisp/casual-editkit-utils.el
+++ b/lisp/casual-editkit-utils.el
@@ -796,9 +796,12 @@ accessed here."
   "Menu for narrow commands."
 
   ["Narrow"
+   ["Page"
+    ("p" "Page" narrow-to-page)]
+
    ["Programming"
-    ("d" "Defun" narrow-to-defun
-     :if (lambda () (derived-mode-p 'prog-mode)))]
+    :if (lambda () (derived-mode-p 'prog-mode))
+    ("d" "Defun" narrow-to-defun)]
 
    ["Org"
     :if (lambda () (derived-mode-p 'org-mode))
diff --git a/tests/test-casual-editkit-utils.el 
b/tests/test-casual-editkit-utils.el
index b16efd771e..c2e9605f66 100644
--- a/tests/test-casual-editkit-utils.el
+++ b/tests/test-casual-editkit-utils.el
@@ -676,10 +676,13 @@
   ;; TODO: need to test for region.
   (let ((tmpfile "casual-editkit-narrow-tmenu.el"))
     (casualt-editkit-setup tmpfile)
-    (cl-letf ((casualt-mock #'narrow-to-defun))
+    (cl-letf ((casualt-mock #'narrow-to-defun)
+              (casualt-mock #'narrow-to-page))
       (let ((test-vectors
-             '((:binding "d" :command narrow-to-defun))))
-
+             '((:binding "d" :command narrow-to-defun)
+               (:binding "p" :command narrow-to-page))))
+        (put 'narrow-to-page 'disabled nil)
+        (put 'narrow-to-region 'disabled nil)
         (emacs-lisp-mode)
         (insert "(defun foo() (message \"hi.\"))")
         (goto-char (point-min))

Reply via email to