Two+1 question about yasnippet

51 views
Skip to first unread message

Ramiro James Rebolledo Cormack

unread,
Oct 10, 2013, 4:51:26 PM10/10/13
to smart-...@googlegroups.com
Hi,

I'm manipulating yasnippet to create some shortcuts to latex.

* Question 1:
For example, I added the follow lines to yasnippet.el:

("lr(" "\\left($0\\right)" "\\left( ... \\right)" nil nil nil nil))
("lr[" "\\left[$0\\right]" "\\left[ ... \\right]" nil nil nil nil)
("lr{" "\\left\\lbrace$0\\right\\rbrace" "\\left\\{ ... \\right\\}" nil nil nil nil)


The idea is that
- when I write "lr(" and TAB then emacs complete with: \left( \right)
- when I write "l{" and TAB then emacs complete with: \left\{ \right\}
etc

There exists some way to do this only in one line? (I need the same for norm, inner products, among others).

* Question 2:
After manipulate yasnipet.el I need to close and reopen the emacs editor to get the difference.
There exists a way to do this without reboot my emacs (maybe some way to just refresh yasnipet without close emacs)?

* Question 3 (end the last):
It's okay to ask this in this mailing list?


Thanks!!

--
Ramiro

João Távora

unread,
Oct 11, 2013, 5:41:58 AM10/11/13
to smart-...@googlegroups.com
Ramiro James Rebolledo Cormack <ramr...@gmail.com> writes:

> For example, I added the follow lines to yasnippet.el:
>
> ("lr(" "\\left($0\\right)" "\\left( ... \\right)" nil nil nil nil))
> ("lr[" "\\left[$0\\right]" "\\left[ ... \\right]" nil nil nil nil)
> ("lr{" "\\left\\lbrace$0\\right\\rbrace" "\\left\\{ ... \\right\\}" nil nil
> nil nil)

Whoo, stop right there? Why are you adding lines to yasnippet.el? Where
are you adding those lines? Are you sure you're not using
yasnippet-bundle.el? It's very old and you should not be using it
anymore.

You should be using the latest yasnippet from github
(http://github.com/capitaomorte/yasnippet) and defining new snippets
with **snippet files**. Read the docs, there's a They are outdated, but
they help you in this basic use case.

> * Question 2:
> After manipulate yasnipet.el I need to close and reopen the emacs editor to
> get the difference.

If you don't "manipulate" yasnippet.el, you can call do "M-x
yas-reload-all", for example

> * Question 3 (end the last):
> It's okay to ask this in this mailing list?

It's OK. But it's better if you open an issue on github, and I'll mark
it a "user support" issue.

J

Rafael

unread,
Oct 10, 2013, 9:46:28 PM10/10/13
to smart-...@googlegroups.com
Ramiro James Rebolledo Cormack <ramr...@gmail.com> writes:

> * Question 2:
> After manipulate yasnipet.el I need to close and reopen the emacs editor to
> get the difference.
> There exists a way to do this without reboot my emacs (maybe some way to
> just refresh yasnipet without close emacs)?

I don't know about your other questions, but here I think you should
run M-x yas-reload-all.


Ramiro James Rebolledo Cormack

unread,
Oct 11, 2013, 10:48:38 AM10/11/13
to smart-...@googlegroups.com



2013/10/11 João Távora <joaot...@gmail.com>

Ramiro James Rebolledo Cormack <ramr...@gmail.com> writes:

> For example, I added the follow lines to yasnippet.el:
>
> ("lr(" "\\left($0\\right)" "\\left( ... \\right)" nil nil nil nil))
> ("lr[" "\\left[$0\\right]" "\\left[ ... \\right]" nil nil nil nil)
> ("lr{" "\\left\\lbrace$0\\right\\rbrace" "\\left\\{ ... \\right\\}" nil nil
> nil nil)

Whoo, stop right there? Why are you adding lines to yasnippet.el? Where
are you adding those lines? Are you sure you're not using
yasnippet-bundle.el? It's very old and you should not be using it
anymore.


  Ups, I allways add lines to my yasnippet-bundle.el. I thought that that was the right way. (although I confess that it seemed strange).


You should be using the latest yasnippet from github
(http://github.com/capitaomorte/yasnippet) and defining new snippets
with **snippet files**. Read the docs, there's a They are outdated, but
they help you in this basic use case.


  Terrific!  The snippet-files looks like simpler (and clean) to use. I'm reading its doc now.

 
> * Question 2:
> After manipulate yasnipet.el I need to close and reopen the emacs editor to
> get the difference.

If you don't "manipulate" yasnippet.el, you can call do "M-x
yas-reload-all", for example


It is just what I wanted, great!
 
> * Question 3 (end the last):
> It's okay to ask this in this mailing list?

It's OK. But it's better if you open an issue on github, and I'll mark
it a "user support" issue.


Thanks!!

--
Ramiro
Reply all
Reply to author
Forward
0 new messages