mohkale / projection

Projectile like project management library built on Emacs project.el
GNU General Public License v3.0
58 stars 3 forks source link

Problems with mode-map key bindings (with a suggested fix) #9

Closed dedi closed 6 months ago

dedi commented 6 months ago

Hello @mohkale. Thank you for this package. For me, this just be the missing link that would allow me to stop using projectile and switch to using project. However, one issue I found is with the keybindings. Keybindings that involve the special keys 'SPC' 'TAB' and 'DEL' are not actually bound the way you think. Instead, you are binding the key sequences. For example. the key sequence 'D'->'E'->'L' is the one that will invoke the projection-cache-clear command. Also, even after fixing that, SPC doesn't actually bind to the projection-per-project-type-map, because it is quoted. The patch below should fix both issues. And thanks again!

index 77c2ce9..64e3ab5 100644
--- a/src/projection.el
+++ b/src/projection.el
@@ -73,16 +73,16 @@
 ;;;###autoload
 (defvar projection-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "SPC" '("Extensions" . (projection-per-project-type-map)))
+    (define-key map (kbd "SPC") `("Extensions" . ,projection-per-project-type-map))
     ;; `projection-core'
     (define-key map "1" 'projection-set-primary-project-type)
     (define-key map "2" 'projection-update-extra-project-types)
     (define-key map "I" 'projection-show-project-info)
-    (define-key map "DEL" 'projection-cache-clear)
+    (define-key map (kbd "DEL") 'projection-cache-clear)
     ;; `projection-artifacts'
     (define-key map "l" 'projection-artifacts-list)
     ;; `projection-find'
-    (define-key map "TAB" 'projection-find-other-file)
+    (define-key map (kbd "TAB") 'projection-find-other-file)
     (define-key map "o"   'projection-find-other-file)
     ;; `projection-hook'
     (define-key map "h" 'projection-hook)
mohkale commented 6 months ago

Oopsie. Thanks for highlighting.