I've got a problem with this snippet, intended for latex-mode:
# -*- mode: snippet -*-
# name: set
# key: set
# binding: "C-?"
# --
\{ `yas/selected-text`$1 \\}$0
The "name" part works OK, so I can expand "set" in latex-mode, but not
the binding. Here's what I get in *Messages* after loading with C-c C-
c in snippet-mode or yas/reload-all:
[yas] warning: keybinding "C-?" invalid for snippet "set" since keymap
"latex-mode-map" does not (yet?) exist.
How come? Thanks,
Jim
(setq latex-mode-map LaTeX-mode-map)
Jim
This only works if it is evaluated after the keymap is defined and
before yas is loaded, but it seems the keymap isn't defined until you
visit a tex file? The only way I can get the keybinding set when I
open a tex file is to add
(setq latex-mode-map LaTeX-mode-map)
(yas/reload-all)
to my LaTeX-mode-hook. I presume there is a better way to do it?
It seems you may be right about the case issue. The setq fix, though
it is close, is not what you want, I think. Try
(defvaralias latex-mode-map LaTeX-mode-map)
And report back here. I'll look into the problem as soon as I can.
Bye!
> --
> You received this message because you are subscribed to the Google Groups "smart-snippet and YASnippet" group.
> To post to this group, send email to smart-...@googlegroups.com.
> To unsubscribe from this group, send email to smart-snippe...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/smart-snippet?hl=en.
>
>
--
João Távora
Jim
Errr, yes, more or less, it's complicated, but anyway in the trunk and
upcoming 0.7 this problem no longer exists, as a variable called
emulation-mode-maps-alist is used, which simplifies the whole issue
and correctly insulates the mode's maps of all yasnippet interference.
I suspect you're using 0.6something, so I encourage you to try out the trunk:
try svn co http://yasnippet.googlecode.com/svn/trunk yasnippet.
and experiment heavily with keybindings since that's one of the most
underused features. Notice that in the new version, multiple snippets,
even across different modes, can share the same keybinding.
Bye!
J
Yes, I'm using 0.6.1c.
> and experiment heavily with keybindings since that's one of the most
> underused features.
Will do. Thanks,
Jim
[...]
[yas] Warning: the "# group:" is no longer supported! [80 times]
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading tramp...done
Automatic display of crossref information was turned on
Starting new Ispell process [default] ...
File mode specification error: (void-variable latex-mode-map)
Applying style hooks...
Loading /home/jim/sdf-git/papers/thesis/auto/main.el (source)...done
Applying style hooks... done
File mode specification error: (void-variable latex-mode-map)
[end of messages]
Removing the defvaralias has no effect.
Jim
On Mar 22, 3:13 pm, João Távora <joaotav...@gmail.com> wrote:
like "emacs -Q -l yasnippet.el -l simpleinit.el"
where simpleinit.el would just contain
(setq yas/snippet-dirs <dir-or-list-of-dirs>)
(yas/reload-all)
If it doesn't happen, then its a problem with your previous config. It
if still happens, post a zip of your latex snippets here, or better
yet, all your snippet dirs, as long as they're relatively small.
PS: I don't think the defvaralias matters anymore. It was just a
workaround for 0.6.1, did you try it?
Thanks!
J
This loads without any errors (*Messages* contains the warnings from
before but no errors). I can see two problems though: there are no
submenus beneath text-mode, just a long list with every snippet
listed, and although I can select a snippet from the menu, neither tab-
expansion or bindings work. I'm using Gnu Emacs 23.0.91.1.
> If it doesn't happen, then its a problem with your previous config. It
> if still happens, post a zip of your latex snippets here, or better
> yet, all your snippet dirs, as long as they're relatively small.
>
> PS: I don't think the defvaralias matters anymore. It was just a
> workaround for 0.6.1, did you try it?
Yes I did, and 0.6.1c is working fine for me with that, so I'm quite
happy to stick to that version for now.
Thanks,
Jim
If you used your own snippet collection please post it here so I can debug this problem.
Thanks,
Joao
Thanks for your help.
Jim
It's strange about that file, but I'm glad it works. From the
behaviour you described earlier (big list of snippets under
text-mode), I would have guessed you tried to use the 0.6 snippet
collection with 0.7, which is incompatible and would produce just
that, since the hierarchy organization has been completely replaced by
the used of ".yas-parents".
So have fun and report any strange behaviour here,
João