[OS X Emacs] Abbrevs

Jan Rosinski jrosinsk at gmail.com
Sat Feb 7 22:06:19 EST 2009

Thanks for all suggestions.
yasnippet from   http://code.google.com/p/yasnippet/
works great.

On Feb 7, 2009, at 2:55 PM, M A wrote:

> On Sat, Feb 7, 2009 at 12:38 AM, Jan Rosinski <jrosinsk at gmail.com>  
> wrote:
>> I was trying to define, unsuccessfully, abbrev of \frac{}{} to be  
>> triggered
>> by \f
>> with the cursor between the first braces at the end, in the local  
>> latex
>> mode.
>> I can do it with fr as a trigger but \f does not work.
>> Eventually, I would like to have several such abbrevs for the math.  
>> Is it
>> possible with
>> the prefix \ ? If not, what is the best solution? Concrete examples  
>> are the
>> best. Thanks.
> In emacs abbrevs only work, I believe, on word characters, which rules
> out using \ in
> the key for the abbrev. I would recommend trying out yasnippet, which
> is what I use
> these day since it is both easy to define a "snippet" and to move the
> point (cursor)
> around. For instance, you would put the following text in a file in
> your snippet directory
> for latex mode,
> #key:\f
> #name: \frac{}{}
> # --
> \frac{$1}{$2}$0
> (without a newline after $0), then after typing \f you press TAB it
> expands into \frac{}{}
> placing the cursor between the first two braces. Press TAB again and
> the cursor moves
> between the second pair of braces. Press TAB a third time and the
> cursor is placed after
> the last brace. There does appear to be a bug where \f does not expand
> if the \ is the first
> character on the line, but otherwise it works for me. You can find  
> yasnippet at
> http://code.google.com/p/yasnippet/
> MarkA
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20090207/6a227427/attachment.html>

More information about the MacOSX-Emacs mailing list