mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
still problematic, I should shift to to vectors when the key is 'TAB'
This commit is contained in:
parent
e8ea8e27c1
commit
1cc002ee32
29
yasnippet.el
29
yasnippet.el
@ -706,19 +706,24 @@ snippet itself contains a condition that returns the symbol
|
|||||||
(defvar yas/minor-mode-map (yas/init-minor-keymap)
|
(defvar yas/minor-mode-map (yas/init-minor-keymap)
|
||||||
"The keymap used when `yas/minor-mode' is active.")
|
"The keymap used when `yas/minor-mode' is active.")
|
||||||
|
|
||||||
|
(defvar yas/trigger-key-map (make-sparse-keymap)
|
||||||
|
"Keymap used only for adding the trigger key to `minor-mode-overriding-map-alist'")
|
||||||
|
|
||||||
(defun yas/trigger-key-reload (&optional unbind-key)
|
(defun yas/trigger-key-reload (&optional unbind-key)
|
||||||
"Rebind `yas/expand' to the new value of `yas/trigger-key'.
|
"Rebind `yas/expand' to the new value of `yas/trigger-key'.
|
||||||
|
|
||||||
With optional UNBIND-KEY, try to unbind that key from
|
With optional UNBIND-KEY, try to unbind that key from
|
||||||
`yas/minor-mode-map'."
|
`yas/minor-mode-map'."
|
||||||
(when (and unbind-key
|
(pushnew (cons 'yas/minor-mode yas/trigger-key-map)
|
||||||
(stringp unbind-key)
|
minor-mode-overriding-map-alist)
|
||||||
(not (string= unbind-key "")))
|
(when (and unbind-key
|
||||||
(define-key yas/minor-mode-map (read-kbd-macro unbind-key) nil))
|
(stringp unbind-key)
|
||||||
(when (and yas/trigger-key
|
(not (string= unbind-key "")))
|
||||||
(stringp yas/trigger-key)
|
(define-key yas/trigger-key-map (read-kbd-macro unbind-key) nil))
|
||||||
(not (string= yas/trigger-key "")))
|
(when (and yas/trigger-key
|
||||||
(define-key yas/minor-mode-map (read-kbd-macro yas/trigger-key) 'yas/expand)))
|
(stringp yas/trigger-key)
|
||||||
|
(not (string= yas/trigger-key "")))
|
||||||
|
(define-key yas/trigger-key-map (read-kbd-macro yas/trigger-key) 'yas/expand)))
|
||||||
|
|
||||||
(defvar yas/tables (make-hash-table)
|
(defvar yas/tables (make-hash-table)
|
||||||
"A hash table of MAJOR-MODE symbols to `yas/table' objects.")
|
"A hash table of MAJOR-MODE symbols to `yas/table' objects.")
|
||||||
@ -783,11 +788,7 @@ Key bindings:
|
|||||||
(cond (yas/minor-mode
|
(cond (yas/minor-mode
|
||||||
;; Reload the trigger key
|
;; Reload the trigger key
|
||||||
;;
|
;;
|
||||||
(push (cons 'yas/minor-mode (let ((map (make-sparse-keymap)))
|
(yas/trigger-key-reload)
|
||||||
(define-key map [tab] 'yas/expand)
|
|
||||||
map))
|
|
||||||
minor-mode-overriding-map-alist)
|
|
||||||
;; (yas/trigger-key-reload)
|
|
||||||
;; Install the direct keymaps in `emulation-mode-map-alists'
|
;; Install the direct keymaps in `emulation-mode-map-alists'
|
||||||
;; (we use `add-hook' even though it's not technically a hook,
|
;; (we use `add-hook' even though it's not technically a hook,
|
||||||
;; but it works). Then define variables named after modes to
|
;; but it works). Then define variables named after modes to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user