emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/sketch-mode 800cd1a 01/12: Create major mode (instead o


From: ELPA Syncer
Subject: [elpa] externals/sketch-mode 800cd1a 01/12: Create major mode (instead of minor mode); better for Spacemacs
Date: Tue, 26 Oct 2021 14:57:40 -0400 (EDT)

branch: externals/sketch-mode
commit 800cd1a30978c1a022cdb8d5318101786dcae263
Author: Daniel Nicolai <dalanicolai@gmail.com>
Commit: Daniel Nicolai <dalanicolai@gmail.com>

    Create major mode (instead of minor mode); better for Spacemacs
    
    The only reason for this commit is that, in Spacemacs, evilifying a 
major-mode
    is much easier than evilifying a minor-mode
---
 sketch-mode.el | 95 +++++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 64 insertions(+), 31 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 1fb2004..5deb44d 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -431,40 +431,73 @@ If value of variable ‘sketch-show-labels' is ‘layer', 
create ..."
 
 (define-key image-map "o" nil)
 
-(define-minor-mode sketch-mode
+(defvar sketch-mode-map
+  (let ((map (make-sparse-keymap))
+        (bindings `(([sketch down-mouse-1] . sketch-interactively)
+                   ([sketch mouse-3] . sketch-text-interactively)
+                   ([sketch C-S-drag-mouse-1] . sketch-crop)
+                   ([sketch S-down-mouse-1] . sketch-select)
+                   ("a" . sketch-set-action)
+                   ("c" . sketch-set-colors)
+                   ("w" . sketch-set-width)
+                   ("sd" . sketch-set-dasharray)
+                   ("fw" . sketch-set-font-with-keyboard)
+                   ("fs" . sketch-set-font-size-by-keyboard)
+                   ("fc" . sketch-set-font-color)
+                   ("v" . sketch-keyboard-select)
+                   ("m" . sketch-modify-object)
+                   ("d" . sketch-remove-object)
+                   ("tg" . sketch-toggle-grid)
+                   ("ts" . sketch-toggle-snap)
+                   ("tt" . sketch-toggle-toolbar)
+                   ("." . sketch-toggle-key-hints)
+                   ("tc" . sketch-toggle-coords)
+                   ("l" . sketch-cycle-labels)
+                   ("D" . sketch-show-definition)
+                   ("u" . sketch-undo)
+                   ("U" . sketch-redo)
+                   ("S" . image-save)
+                   (,(kbd "C-c C-c") . sketch-quick-insert-image)
+                   ("?" . sketch-help)
+                   ("Q" . sketch-quit))))
+    (dolist (b bindings)
+      (define-key map (car b) (cdr b)))
+    map))
+
+(define-derived-mode sketch-mode special-mode "sketch-mode"
   "Create svg images using the mouse.
 In sketch-mode buffer press \\[sketch-transient] to activate the
 transient."
-  :lighter "sketch-mode"
-  :keymap
-  `(
-    ([sketch down-mouse-1] . sketch-interactively)
-    ([sketch mouse-3] . sketch-text-interactively)
-    ([sketch C-S-drag-mouse-1] . sketch-crop)
-    ([sketch S-down-mouse-1] . sketch-select)
-    ("a" . sketch-set-action)
-    ("c" . sketch-set-colors)
-    ("w" . sketch-set-width)
-    ("sd" . sketch-set-dasharray)
-    ("fw" . sketch-set-font-with-keyboard)
-    ("fs" . sketch-set-font-size-by-keyboard)
-    ("fc" . sketch-set-font-color)
-    ("v" . sketch-keyboard-select)
-    ("m" . sketch-modify-object)
-    ("d" . sketch-remove-object)
-    ("tg" . sketch-toggle-grid)
-    ("ts" . sketch-toggle-snap)
-    ("tt" . sketch-toggle-toolbar)
-    ("." . sketch-toggle-key-hints)
-    ("tc" . sketch-toggle-coords)
-    ("l" . sketch-cycle-labels)
-    ("D" . sketch-show-definition)
-    ("u" . sketch-undo)
-    ("U" . sketch-redo)
-    ("S" . image-save)
-    (,(kbd "C-c C-c") . sketch-quick-insert-image)
-    ("?" . sketch-help)
-    ("Q" . sketch-quit))
+  ;; :lighter "sketch-mode"
+  ;; :keymap
+  ;; `(
+  ;;   ([sketch down-mouse-1] . sketch-interactively)
+  ;;   ([sketch mouse-3] . sketch-text-interactively)
+  ;;   ([sketch C-S-drag-mouse-1] . sketch-crop)
+  ;;   ([sketch S-down-mouse-1] . sketch-select)
+  ;;   ("a" . sketch-set-action)
+  ;;   ("c" . sketch-set-colors)
+  ;;   ("w" . sketch-set-width)
+  ;;   ("sd" . sketch-set-dasharray)
+  ;;   ("fw" . sketch-set-font-with-keyboard)
+  ;;   ("fs" . sketch-set-font-size-by-keyboard)
+  ;;   ("fc" . sketch-set-font-color)
+  ;;   ("v" . sketch-keyboard-select)
+  ;;   ("m" . sketch-modify-object)
+  ;;   ("d" . sketch-remove-object)
+  ;;   ("tg" . sketch-toggle-grid)
+  ;;   ("ts" . sketch-toggle-snap)
+  ;;   ("tt" . sketch-toggle-toolbar)
+  ;;   ("." . sketch-toggle-key-hints)
+  ;;   ("tc" . sketch-toggle-coords)
+  ;;   ("l" . sketch-cycle-labels)
+  ;;   ("D" . sketch-show-definition)
+  ;;   ("u" . sketch-undo)
+  ;;   ("U" . sketch-redo)
+  ;;   ("S" . image-save)
+  ;;   (,(kbd "C-c C-c") . sketch-quick-insert-image)
+  ;;   ("?" . sketch-help)
+  ;;   ("Q" . sketch-quit))
     ;; (,(kbd "C-c C-s") . sketch-transient))
   (with-no-warnings
     (if (boundp 'undo-tree-mode)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]