branch: externals/poke
commit dcc2faebb8e73a6c3fd319960cd7da5621ed1d77
Author: Jose E. Marchesi <[email protected]>
Commit: Jose E. Marchesi <[email protected]>

    poke.el: add `q' command in poke-edit buffers
---
 poke.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/poke.el b/poke.el
index a8aa6bea85..618b1d8acd 100644
--- a/poke.el
+++ b/poke.el
@@ -1064,7 +1064,7 @@ fun plet_elval = (string s) void:
 (defun poke-edit-2 (name type typekind elem-names elem-values)
   (let ((buf (get-buffer-create "*poke-edit*")))
     (with-current-buffer buf
-      (kill-all-local-variables)
+      (poke-edit-mode)
       (setq-local edit-name name)
       (setq-local edit-type type)
       (setq-local edit-typekind typekind)
@@ -1074,6 +1074,18 @@ fun plet_elval = (string s) void:
       (when (not (get-buffer-window "*poke-edit*"))
         (switch-to-buffer-other-window "*poke-edit*")))))
 
+(defvar poke-edit-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map widget-keymap)
+    (define-key map (kbd "q") 'quit-window)
+    map))
+
+(defun poke-edit-mode ()
+  "Major mode for editing Poke values."
+  (interactive)
+  (kill-all-local-variables)
+  (use-local-map poke-edit-mode-map))
+
 (defun poke-edit-do-buffer ()   
   (let ((inhibit-read-only t))
     (erase-buffer))
@@ -1118,7 +1130,6 @@ fun plet_elval = (string s) void:
                                 ("array" "]")
                                 (_ ""))
                          "\n"))
-  (use-local-map widget-keymap)
   (widget-setup)
   (goto-char (point-min)))
 

Reply via email to