Fixed yas/minor-mode definition

9 views
Skip to first unread message

Kentaro Kuribayashi

unread,
Mar 19, 2008, 7:42:59 AM3/19/08
to smart-...@googlegroups.com
Hi,

I've been really confused after the release of yasnippet ver 0.3.0, in
which yas/minor-mode was introduced, because yas/minor-mode-map wasn't
correctly defined in my environment, emacs -nw. That is:

a) yas/trigger key wasn't correctly mapped to yas/expand in
yas/minor-mode though I redefined it in my .emacs like this:

(setq yas/trigger-key (kbd "SPC"))

b) There was a problem I made a issue below:

http://code.google.com/p/yasnippet/issues/detail?id=9

I think those problems now got fixed. In yasnippet.el, yas/minor-mode
is defined using easy-mmode, and yas/minor-mode-map was automatically
generated by define-minor-mode function. The document of the function
says:

It's generally better to use a separate mode-map variable than
to use this argument.

I guessed it was the cause of the problems and fixed the code around
the definition of yas/minor-mode as below (I attached it as a patch
file against r178). It just works fine. How do you think about it?

Index: yasnippet.el
===================================================================
--- yasnippet.el (revision 178)
+++ yasnippet.el (working copy)
@@ -169,6 +169,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; YASnippet minor mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defvar yas/minor-mode-map (make-sparse-keymap)
+ "The keymap of yas/minor-mode")
+
(define-minor-mode yas/minor-mode
"Toggle YASnippet mode.
With no argument, this command toggles the mode.
@@ -183,9 +186,8 @@
nil
;; The indicator for the mode line.
" yas"
- ;; The minor mode bindings.
- `((,yas/trigger-key . yas/expand))
- :group 'editing)
+ :group 'editing
+ (define-key yas/minor-mode-map yas/trigger-key 'yas/expand))
(defun yas/minor-mode-on ()
"Turn on YASnippet minor mode."
(interactive)

--
Kentaro Kuribayashi
Just another Blogger

Web: http://kentarok.org/
E-Mail: kent...@gmail.com

fix-minor-mode-def.patch

pluskid

unread,
Mar 19, 2008, 8:16:16 AM3/19/08
to smart-snippet
Hi! Thank you for this patch. It is accepted and released with
0.3.2. :)
Reply all
Reply to author
Forward
0 new messages