1 # -*- mode: org; fill-column: 80 -*-
2 #+TITLE: Yet another snippet extension
6 #+STYLE: <link rel="stylesheet" type="text/css" href="stylesheets/styles.css" />
10 #+LINK: smart-snippet http://code.google.com/p/smart-snippet
11 #+LINK: pluskid http://pluskid.lifegoo.org
13 #+LINK: screencast http://www.youtube.com/watch?v=ZCGmZK4V7Sg
14 #+LINK: docs http://capitaomorte.github.com/yasnippet
15 #+LINK: issues https://github.com/capitaomorte/yasnippet/issues
16 #+LINK: googlecode-tracker http://code.google.com/p/yasnippet/issues/list
17 #+LINK: forum http://groups.google.com/group/smart-snippet
22 *YASnippet* is a template system for Emacs. It allows you to type an
23 abbreviation and automatically expand it into function templates. Bundled
24 language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML,
25 CSS and more. The snippet syntax is inspired from TextMate's syntax, you can
26 even [[#import-textmate][import most TextMate snippets]]
28 YASnippet is an original creation of [[pluskid]] who also wrote its predecessor
37 Clone this repository somewhere
40 $ cd ~/.emacs.d/plugins
41 $ git clone https://github.com/capitaomorte/yasnippet
44 Add the following in your =.emacs= file:
47 (add-to-list 'load-path
48 "~/.emacs.d/plugins/yasnippet")
53 Add your own snippets to =~/.emacs.d/snippets= by placing files there or
54 invoking =yas/new-snippet=.
56 ** Import textmate snippets (rails example)
58 :CUSTOM_ID: import-textmate
61 YASnippet lets you use TextMate bundles directly:
64 $ cd ~/.emacs.d/plugins
65 $ git clone https://github.com/capitaomorte/yasnippet
68 $ git submodule update
69 $ gem install plist trollop
70 $ rake convert_bundles # will convert ruby, rails and html bundles from drnic
73 Then, in your =.emacs= file
76 (add-to-list 'load-path
77 "~/.emacs.d/plugins/yasnippet")
79 (setq yas/snippet-dirs '("~/.emacs.d/snippets" "~/.emacs.d/extras/imported"))
83 Open some rails file (model, app, etc) and start using the textmate
84 snippets. Consider that this is a work-in-progress and many snippets/commands
85 might not work. Patches welcome!
87 ** Contributing snippets
89 Please *do not ask me* to add snippets to the default collection under
90 =/snippets=. This collection is considered frozen. By customizing
91 =yas/snippet-dirs= you can point yasnippet to good snippet collections out
94 The =extras/textmate-import.rb= tool can import many actual Textmate
95 snippets. I'm focusing on developing it and the accompanying =yas-setup.el=
96 files that guide it with more difficult importations. The idea is to deprecate
97 =/snippets= and replace it with =extras/imported=.
99 ** Documentation, issues, etc
101 Please refer to the comprehensive [[docs][documentation]] for full customization and
102 support. If you think you've found a bug, please report it on [[issues][the GitHub
103 issue tracker]]. (please **do not** submit new issues to the old
104 [[googlecode-tracker][googlecode tracker]])
106 If you run into problems using YASnippet, or have snippets to contribute, post
107 to the [[forum][yasnippet forum]]. Thank you very much for using YASnippet!
109 * Organizing snippets
113 Snippet collections can be stored in plain text files. They are arranged by
114 sub-directories naming *snippet tables*. These mostly name Emacs major names.
127 The collections are loaded into *snippet tables* which the triggering mechanism
128 (see [[#expand-snippets][Expanding snippets]]) looks up and (hopefully) cause the right snippet to
131 ** Setting up =yas/snippet-dirs=
133 An emacs variable =yas/snippet-dirs= tells YASnippet which collections to
134 consider. It's used when you activate =yas/global-mode= or call
135 =yas/reload-all= interactively.
137 The default considers:
139 - a personal collection that lives in =~/.emacs.d/snippets=
140 - the bundled collection, taken as a relative path to =yasnippet.el= localtion
142 When you come across other snippet collections, do the following to try them
145 #+begin_src emacs-lisp :exports both
146 ;; Develop in ~/emacs.d/mysnippets, but also
147 ;; try out snippets in ~/Downloads/interesting-snippets
148 (setq yas/snippet-dirs '("~/emacs.d/mysnippets"
149 "~/Downloads/interesting-snippets"))
151 ;; OR, keeping yasnippet's defaults try out ~/Downloads/interesting-snippets
152 (setq yas/snippet-dirs (append yas/snippet-dirs
153 '("~/Downloads/interesting-snippets")))
156 Collections appearing earlier in the list shadow snippets with same names
157 appearing in collections later in the list. =yas/new-snippet= always stores
158 snippets in the first collection.
160 ** The =.yas.parents= file
162 It's very useful to have certain modes share snippets between themselves. To do
163 this, choose a mode subdirectory and place a =.yas-parents= containing a
164 whitespace-separated list of other mode names. When you reload those modes
165 become parents of the original mode.
170 | |-- .yas-parents # contains "cc-mode text-mode"
176 | |-- .yas-parents # contains "cc-mode text-mode"
183 ** TODO The =.yas-make-groups= file
185 If you place an empty plain text file =.yas-make-groups= inside one of the
186 mode directories, the names of these sub-directories are considered groups of
187 snippets and [[snippet-menu][the menu]] is organized much more cleanly:
191 Another alternative way to achieve this is to place a ==# group:==
192 directive inside the snippet definition. See =Writing Snippets=_.
201 |-- control structure
210 Yet another way to create a nice snippet menu is to write into
213 ** TODO The =.yas-setup.el= file
217 ** TODO The =.yas-compiled-snippet.el= file
221 ** The =.yas-skip= file
226 :CUSTOM_ID: expand-snippets
229 This section describes how YASnippet chooses snippets for expansion at point.
231 Maybe, you'll want some snippets to be expanded in a particular
232 mode, or only under certain conditions, or be prompted using
234 ** Triggering expansion
236 You can use YASnippet to expand snippets in different ways:
238 * Typing an abbreviation, the snippet *trigger key*, and then pressing the key
239 defined in ==yas/trigger-key== (usually to "TAB"). This works in buffers
240 where the minor mode ==yas/minor-mode== is active;
242 * By invoking the command ==yas/insert-snippet== (either by typing ==M-x
243 yas/insert-snippet== or its keybinding). This does *not*
244 require ==yas/minor-mode== to be active.
246 * By using the keybinding associated with an active snippet. This also
247 requires ==yas/minor-mode== to be active;
249 * By expanding directly from the "YASnippet" menu in the menu-bar
251 * By using hippie-expand
253 * Use m2m's excellent auto-complete
255 # \* Expanding from emacs-lisp code
260 # When ==yas/minor-mode== is enabled, the keybinding taken from
261 # ==yas/trigger-key== will take effect.
263 # ==yas/trigger-key== invokes ==yas/expand==, which tries to expand a
264 # \*snippet abbrev* (also known as *snippet key*) before point.
266 # The default key is =="TAB"==, however, you can freely set it to some
269 # .. image:: images/minor-mode-indicator.png
272 # To enable the YASnippet minor mode in all buffers globally use the
273 # command ==yas/global-mode==.
275 # When you use ==yas/global-mode== you can also selectively disable
276 # YASnippet in some buffers by setting the buffer-local variable
277 # ==yas/dont-active== in the buffer's mode hook.
279 # Trouble when using or understanding the ==yas/trigger-key== is easily
280 # the most controversial issue in YASsnippet. See the =FAQ <faq.html>=_.
285 # ==yas/fallback-behaviour== is a customization variable bound to
286 # =='call-other-command== by default. If ==yas/expand== failed to find
287 # any suitable snippet to expand, it will disable the minor mode
288 # temporarily and find if there's any other command bound the
289 # ==yas/trigger-key==.
291 # If found, the command will be called. Usually this works very well --
292 # when there's a snippet, expand it, otherwise, call whatever command
293 # originally bind to the trigger key.
295 # However, you can change this behavior by customizing the
296 # ==yas/fallback-behavior== variable. If you set this variable to
297 # =='return-nil==, it will return ==nil== instead of trying to call the
298 # \*original* command when no snippet is found.
303 # The command ==M-x yas/insert-snippet== lets you insert snippets at
304 # point *for you current major mode*. It prompts you for the snippet
305 # key first, and then for a snippet template if more than one template
306 # exists for the same key.
308 # The list presented contains the snippets that can be inserted at
309 # point, according to the condition system. If you want to see all
310 # applicable snippets for the major mode, prefix this command with
313 # The prompting methods used are again controlled by
314 # ==yas/prompt-functions==.
319 # See the section of the ==# binding:== directive in =Writing
323 # Expanding from the menu
324 # -----------------------
326 # See =the YASnippet Menu=_.
328 # Expanding with ==hippie-expand==
329 # ----------------------------------
331 # To integrate with ==hippie-expand==, just put
332 # ==yas/hippie-try-expand== in
333 # ==hippie-expand-try-functions-list==. This probably makes more sense
334 # when placed at the top of the list, but it can be put anywhere you
337 # Expanding from emacs-lisp code
338 # ------------------------------
340 # Sometimes you might want to expand a snippet directly from you own
341 # elisp code. You should call ==yas/expand-snippet== instead of
342 # ==yas/expand== in this case.
344 # As with expanding from the menubar, the condition system and multiple
345 # candidates doesn't affect expansion. In fact, expanding from the
346 # YASnippet menu has the same effect of evaluating the follow code:
348 # .. sourcecode:: common-lisp
350 # (yas/expand-snippet template)
352 # See the internal documentation on ==yas/expand-snippet== for more
355 # Controlling expansion
356 # =====================
361 # YASnippet does quite a bit of filtering to find out which snippets are
362 # eligible for expanding at the current cursor position.
364 # In particular, the following things matter:
366 # \* Currently loaded snippets tables
368 # These are loaded from a directory hierarchy in your file system. See
369 # =Organizing Snippets=_. They are named after major modes like
370 # ==html-mode==, ==ruby-mode==, etc...
372 # \* Major mode of the current buffer
374 # If the currrent major mode matches one of the loaded snippet tables,
375 # then all that table's snippets are considered for expansion. Use
376 # ==M-x describe-variable RET major-mode RET== to find out which major
377 # mode you are in currently.
381 # Snippet tables defined as the parent of some other eligible table
382 # are also considered. This works recursively, i.e. parents of parents
383 # of eligible tables are also considered.
385 # \* Buffer-local ==yas/mode-symbol== variable
387 # This can be used to consider snippet tables whose name does not
388 # correspond to a major mode. If you set this variable to a name ,
389 # like ==rinari-minor-mode==, you can have some snippets expand only
390 # in that minor mode. Naturally, you want to set this conditionally,
391 # i.e. only when entering that minor mode, so using a hook is a good
394 # .. sourcecode:: common-lisp
396 # ;; When entering rinari-minor-mode, consider also the snippets in the
397 # ;; snippet table "rails-mode"
398 # (add-hook 'rinari-minor-mode-hook
400 # (setq yas/mode-symbol 'rails-mode)))
402 # \* Buffer-local ==yas/buffer-local-condition== variable
404 # This variable provides finer grained control over what snippets can
405 # be expanded in the current buffer. The default value won't let you
406 # expand snippets inside comments or string literals for example. See
407 # =The condition system=_ for more info.
409 # The condition system
410 # --------------------
412 # Consider this scenario: you are an old Emacs hacker. You like the
413 # abbrev-way and set ==yas/trigger-key== to =="SPC"==. However,
414 # you don't want ==if== to be expanded as a snippet when you are typing
415 # in a comment block or a string (e.g. in ==python-mode==).
417 # If you use the ==# condition :== directive (see =Writing Snippets=_)
418 # you could just specify the condition for ==if== to be ==(not
419 # (python-in-string/comment))==. But how about ==while==, ==for==,
420 # etc. ? Writing the same condition for all the snippets is just
421 # boring. So has a buffer local variable
422 # ==yas/buffer-local-condition==. You can set this variable to ==(not
423 # (python-in-string/comment))== in ==python-mode-hook==.
425 # Then, what if you really want some particular snippet to expand even
426 # inside a comment? This is also possible! But let's stop telling the
427 # story and look at the rules:
429 # \* If ==yas/buffer-local-condition== evaluate to nil, no snippets will
430 # be considered for expansion.
432 # \* If it evaluates to the a *cons cell* where the ==car== is the symbol
433 # ==require-snippet-condition== and the ==cdr== is a symbol (let's
434 # call it ==requirement==), then:
436 # * Snippets having no ==# condition:== directive won't be considered;
438 # * Snippets with conditions that evaluate to nil (or produce an
439 # error) won't be considered;
441 # * If the snippet has a condition that evaluates to non-nil (let's
442 # call it ==result==):
444 # * If ==requirement== is ==t==, the snippet is ready to be
447 # * If ==requirement== is ==eq== to ==result==, the snippet is ready
450 # * Otherwise the snippet won't be considered.
452 # \* If it evaluates to the symbol ==always==, all snippets are
453 # considered for expansion, regardless of any conditions.
455 # \* If it evaluate to ==t== or some other non-nil value:
457 # * If the snippet has no condition, or has a condition that evaluate
458 # to non-nil, it is ready to be expanded.
460 # * Otherwise, it won't be considered.
462 # In the mentioned scenario, set ==yas/buffer-local-condition== like
465 # .. sourcecode:: common-lisp
467 # (add-hook 'python-mode-hook
469 # (setq yas/buffer-local-condition
470 # '(if (python-in-string/comment)
471 # '(require-snippet-condition . force-in-comment)
474 # ... and specify the condition for a snippet that you're going to
475 # expand in comment to be evaluated to the symbol
476 # ==force-in-comment==. Then it can be expanded as you expected, while
477 # other snippets like ==if== still can't expanded in comment.
479 # Multiples snippet with the same key
480 # -----------------------------------
482 # The rules outlined =above <Eligible snippets>=_ can return more than
483 # one snippet to be expanded at point.
485 # When there are multiple candidates, YASnippet will let you select
486 # one. The UI for selecting multiple candidate can be customized through
487 # ==yas/prompt-functions== , which defines your preferred methods of
488 # being prompted for snippets.
490 # You can customize it with ==M-x customize-variable RET
491 # yas/prompt-functions RET==. Alternatively you can put in your
494 # .. sourcecode:: common-lisp
496 # (setq yas/prompt-functions '(yas/x-prompt yas/dropdown-prompt))
498 # Currently there are some alternatives solution with YASnippet.
500 # .. image:: images/x-menu.png
503 # Use the X window system
504 # ~~~~~~~~~~~~~~~~~~~~~~~
506 # The function ==yas/x-prompt== can be used to show a popup menu for you
507 # to select. This menu will be part of you native window system widget,
510 # \* It usually looks beautiful. E.g. when you compile Emacs with gtk
511 # support, this menu will be rendered with your gtk theme.
512 # \* Your window system may or may not allow to you use ==C-n==, ==C-p==
513 # to navigate this menu.
514 # \* This function can't be used when in a terminal.
516 # .. image:: images/ido-menu.png
519 # Minibuffer prompting
520 # ~~~~~~~~~~~~~~~~~~~~
522 # You can use functions ==yas/completing-prompt== for the classic emacs
523 # completion method or ==yas/ido-prompt== for a much nicer looking
524 # method. The best way is to try it. This works in a terminal.
526 # .. image:: images/dropdown-menu.png
529 # Use ==dropdown-menu.el==
530 # ~~~~~~~~~~~~~~~~~~~~~~~~
532 # The function ==yas/dropdown-prompt== can also be placed in the
533 # ==yas/prompt-functions== list.
535 # This works in both window system and terminal and is customizable, you
536 # can use ==C-n==, ==C-p== to navigate, ==q== to quit and even press
537 # ==6== as a shortcut to select the 6th candidate.
542 # See below for the documentation on variable ==yas/prompt-functions==
544 # Customizable Variables
545 # ======================
547 # ==yas/prompt-functions==
548 # ------------------------
550 # You can write a function and add it to the ==yas/prompt-functions==
551 # list. These functions are called with the following arguments:
553 # \* PROMPT: A string to prompt the user;
555 # \* CHOICES: A list of strings or objects;
557 # \* optional DISPLAY-FN : A function. When applied to each of the
558 # objects in CHOICES it will return a string;
560 # The return value of any function you put here should be one of
561 # the objects in CHOICES, properly formatted with DISPLAY-FN (if
564 # \* To signal that your particular style of prompting is unavailable at
565 # the moment, you can also have the function return nil.
567 # \* To signal that the user quit the prompting process, you can signal
568 # ==quit== with ==(signal 'quit "user quit!")==
570 # ==yas/fallback-behavior==
571 # -------------------------
573 # How to act when ==yas/expand== does *not* expand a snippet.
575 # ==call-other-command== means try to temporarily disable YASnippet and
576 # call the next command bound to ==yas/trigger-key==.
578 # ==return-nil== means return nil. (i.e. do nothing)
580 # An entry (apply COMMAND . ARGS) means interactively call COMMAND, if
581 # ARGS is non-nil, call COMMAND non-interactively with ARGS as
584 # ==yas/choose-keys-first==
585 # -------------------------
587 # If non-nil, prompt for snippet key first, then for template.
589 # Otherwise prompts for all possible snippet names.
591 # This affects ==yas/insert-snippet== and ==yas/visit-snippet-file==.
593 # ==yas/choose-tables-first==
594 # ---------------------------
596 # If non-nil, and multiple eligible snippet tables, prompts user for
599 # Otherwise, user chooses between the merging together of all
602 # This affects ==yas/insert-snippet==, ==yas/visit-snippet-file==
604 # ==yas/key-syntaxes==
605 # --------------------
607 # The default searching strategy is quite powerful. For example, in
608 # ==c-mode==, ==bar==, ==foo_bar==, =="#foo_bar"== can all be recognized
609 # as a snippet key. Furthermore, the searching is in that order. In
610 # other words, if ==bar== is found to be a key to some *valid* snippet,
611 # then that snippet is expanded and replaces the ==bar==. Snippets
612 # pointed to by ==foo_bar== and =="#foobar== won't be considered.
614 # However, this strategy can also be customized easily from the
615 # ==yas/key-syntaxes== variable. It is a list of syntax rules, the
616 # default value is ==("w" "w_" "w_." "^ ")==. Which means search the
617 # following thing until found one:
620 # \* a symbol. In lisp, ==-== and ==?== can all be part of a symbol.
621 # \* a sequence of characters of either word, symbol or punctuation.
622 # \* a sequence of characters of non-whitespace characters.
624 # But you'd better keep the default value unless you want to understand
625 # how Emacs's syntax rules work...
629 # * snippet-development.org
634 # .. _Organizing Snippets: snippet-organization.html
635 # .. _Expanding Snippets: snippet-expansion.html
636 # .. _Writing Snippets: snippet-development.html
637 # .. _The YASnippet Menu: snippet-menu.html
641 # Snippet development
642 # ===================
644 # Quickly finding snippets
645 # ------------------------
647 # There are some ways you can quickly find a snippet file:
649 # \* ==M-x yas/new-snippet==
651 # Prompts you for a snippet name, then tries to guess a suitable
652 # directory to store it, prompting you for creation if it does not
653 # exist. Finally, places you in a new buffer set to ==snippet-mode==
654 # so you can write your snippet.
656 # \* ==M-x yas/find-snippets==
658 # Lets you find the snippet file in the directory the snippet was
659 # loaded from (if it exists) like ==find-file-other-window==. The
660 # directory searching logic is similar to ==M-x yas/new-snippet==.
662 # \* ==M-x yas/visit-snippet-file==
664 # Prompts you for possible snippet expansions like
665 # ==yas/insert-snippet==, but instead of expanding it, takes you
666 # directly to the snippet definition's file, if it exists.
668 # Once you find this file it will be set to ==snippet-mode== (see ahead)
669 # and you can start editing your snippet.
672 # Using the ==snippet-mode== major mode
673 # -------------------------------------
675 # There is a major mode ==snippet-mode== to edit snippets. You can set
676 # the buffer to this mode with ==M-x snippet-mode==. It provides
677 # reasonably useful syntax highlighting.
679 # Two commands are defined in this mode:
681 # \* ==M-x yas/load-snippet-buffer==
683 # When editing a snippet, this loads the snippet into the correct
684 # mode and menu. Bound to ==C-c C-c== by default while in
687 # \* ==M-x yas/tryout-snippet==
689 # When editing a snippet, this opens a new empty buffer, sets it to
690 # the appropriate major mode and inserts the snippet there, so you
691 # can see what it looks like. This is bound to ==C-c C-t== while in
694 # There are also *snippets for writing snippets*: ==vars==, ==$f== and
700 # A file defining a snippet generally contains the template to be
703 # Optionally, if the file contains a line of ==# --==, the lines above
704 # it count as comments, some of which can be *directives* (or meta
705 # data). Snippet directives look like ==# property: value== and tweak
706 # certain snippets properties described below. If no ==# --== is found,
707 # the whole file is considered the snippet template.
709 # Here's a typical example:
711 # .. sourcecode:: text
713 # # contributor: pluskid <pluskid@gmail.com>
718 # Here's a list of currently supported directives:
720 # ==# key:== snippet abbrev
721 # --------------------------
723 # This is the probably the most important directive, it's the abbreviation you
724 # type to expand a snippet just before hitting ==yas/trigger-key==. If you don't
725 # specify this the snippet will not be expandable through the key mechanism.
727 # ==# name:== snippet name
728 # ------------------------
730 # This is a one-line description of the snippet. It will be displayed in
731 # the menu. It's a good idea to select a descriptive name for a
732 # snippet -- especially distinguishable among similar snippets.
734 # If you omit this name it will default to the file name the snippet was
737 # ==# condition:== snippet condition
738 # ----------------------------------
739 # This is a piece of Emacs-lisp code. If a snippet has a condition, then it
740 # will only be expanded when the condition code evaluate to some non-nil
743 # See also ==yas/buffer-local-condition== in =Expanding snippets=_
746 # ==# group:== snippet menu grouping
747 # ----------------------------------
749 # When expanding/visiting snippets from the menu-bar menu, snippets for a
750 # given mode can be grouped into sub-menus . This is useful if one has
751 # too many snippets for a mode which will make the menu too
754 # The ==# group:== property only affect menu construction (See =the
755 # YASnippet menu=_) and the same effect can be achieved by grouping
756 # snippets into sub-directories and using the ==.yas-make-groups==
757 # special file (for this see =Organizing Snippets=_
760 # Refer to the bundled snippets for ==ruby-mode== for examples on the
761 # ==# group:== directive. Group can also be nested, e.g. ==control
762 # structure.loops== tells that the snippet is under the ==loops== group
763 # which is under the ==control structure== group.
765 # ==# expand-env:== expand environment
766 # ------------------------------------
768 # This is another piece of Emacs-lisp code in the form of a ==let==
769 # \*varlist form*, i.e. a list of lists assigning values to variables. It
770 # can be used to override variable values while the snippet is being
773 # Interesting variables to override are ==yas/wrap-around-region== and
774 # ==yas/indent-line== (see =Expanding Snippets=_).
776 # As an example, you might normally have ==yas/indent-line== set to
777 # =='auto== and ==yas/wrap-around-region== set to ==t==, but for this
778 # particularly brilliant piece of ASCII art these values would mess up
779 # your hard work. You can then use:
781 # .. sourcecode:: text
784 # # expand-env: ((yas/indent-line 'fixed) (yas/wrap-around-region 'nil))
797 # ==# binding:== direct keybinding
798 # ---------------------------------
800 # You can use this directive to expand a snippet directly from a normal
801 # Emacs keybinding. The keybinding will be registered in the Emacs
802 # keymap named after the major mode the snippet is active
805 # Additionally a variable ==yas/prefix== is set to to the prefix
806 # argument you normally use for a command. This allows for small
807 # variations on the same snippet, for example in this "html-mode"
810 # .. sourcecode:: text
813 # # binding: C-c C-c C-m
815 # <p>=(when yas/prefix "\n")=$0=(when yas/prefix "\n")=</p>
817 # This binding will be recorded in the keymap
818 # ==html-mode-map==. To expand a paragraph tag newlines, just
819 # press ==C-u C-c C-c C-m==. Omitting the ==C-u== will expand the
820 # paragraph tag without newlines.
822 # ==# contributor:== snippet author
823 # ---------------------------------------------------
825 # This is optional and has no effect whatsoever on snippet
826 # functionality, but it looks nice.
831 # The syntax of the snippet template is simple but powerful, very
832 # similar to TextMate's.
837 # Arbitrary text can be included as the content of a template. They are
838 # usually interpreted as plain text, except ==$== and =====. You need to
839 # use ==\== to escape them: ==\$== and ==\===. The ==\== itself may also
840 # needed to be escaped as ==\\== sometimes.
842 # Embedded Emacs-lisp code
843 # ------------------------
845 # Emacs-Lisp code can be embedded inside the template, written inside
846 # back-quotes (=====). The lisp forms are evaluated when the snippet is
847 # being expanded. The evaluation is done in the same buffer as the
848 # snippet being expanded.
850 # Here's an example for ==c-mode== to calculate the header file guard
853 # .. sourcecode:: text
855 # #ifndef ${1:_=(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))=_H_}
862 # From version 0.6, snippets expansions are run with some special
863 # Emacs-lisp variables bound. One of this is ==yas/selected-text==. You
864 # can therefore define a snippet like:
866 # .. sourcecode:: text
869 # =yas/selected-text=$0
872 # to "wrap" the selected region inside your recently inserted
873 # snippet. Alternatively, you can also customize the variable
874 # ==yas/wrap-around-region== to ==t== which will do this automatically.
879 # Tab stops are fields that you can navigate back and forth by ==TAB==
880 # and ==S-TAB==. They are written by ==$== followed with a
881 # number. ==$0== has the special meaning of the *exit point* of a
882 # snippet. That is the last place to go when you've traveled all the
883 # fields. Here's a typical example:
885 # .. sourcecode:: text
894 # Tab stops can have default values -- a.k.a placeholders. The syntax is
897 # .. sourcecode:: text
901 # They acts as the default value for a tab stop. But when you firstly
902 # type at a tab stop, the default value will be replaced by your
903 # typing. The number can be omitted if you don't want to create
904 # =mirrors=_ or =transformations=_ for this field.
911 # We refer the tab stops with placeholders as a *field*. A field can have
912 # mirrors. Its mirrors will get updated when you change the text of a
913 # field. Here's an example:
915 # .. sourcecode:: text
917 # \begin{${1:enumerate}}
921 # When you type =="document"== at ==${1:enumerate}==, the word
922 # =="document"== will also be inserted at ==\end{$1}==. The best
923 # explanation is to see the screencast(=YouTube
924 # <http://www.youtube.com/watch?v=vOj7btx3ATg>=_ or =avi video
925 # <http://yasnippet.googlecode.com/files/yasnippet.avi>=_).
927 # The tab stops with the same number to the field act as its mirrors. If
928 # none of the tab stops has an initial value, the first one is selected
929 # as the field and others mirrors.
931 # .. _transformations:
933 # Mirrors with transformations
934 # ----------------------------
936 # If the value of an ==${n:==-construct starts with and contains ==$(==,
937 # then it is interpreted as a mirror for field ==n== with a
938 # transformation. The mirror's text content is calculated according to
939 # this transformation, which is Emacs-lisp code that gets evaluated in
940 # an environment where the variable ==text== (or ==yas/text==) is bound
941 # to the text content (string) contained in the field ==n==.Here's an
942 # example for Objective-C:
944 # .. sourcecode:: text
946 # - (${1:id})${2:foo}
951 # - (void)set${2:$(capitalize text)}:($1)aValue
954 # $2 = [aValue retain];
958 # Look at ==${2:$(capitalize text)}==, it is a mirror with
959 # transformation instead of a field. The actual field is at the first
960 # line: ==${2:foo}==. When you type text in ==${2:foo}==, the
961 # transformation will be evaluated and the result will be placed there
962 # as the transformed text. So in this example, if you type "baz" in the
963 # field, the transformed text will be "Baz". This example is also
964 # available in the screencast.
966 # Another example is for ==rst-mode==. In reStructuredText, the document
967 # title can be some text surrounded by "===" below and above. The "==="
968 # should be at least as long as the text. So
970 # .. sourcecode:: text
976 # is a valid title but
978 # .. sourcecode:: text
984 # is not. Here's an snippet for rst title:
986 # .. sourcecode:: text
988 # ${1:$(make-string (string-width text) ?\=)}
990 # ${1:$(make-string (string-width text) ?\=)}
994 # Fields with transformations
995 # ---------------------------
997 # From version 0.6 on, you can also have lisp transformation inside
998 # fields. These work mostly mirror transformations but are evaluated
999 # when you first enter the field, after each change you make to the
1000 # field and also just before you exit the field.
1002 # The syntax is also a tiny bit different, so that the parser can
1003 # distinguish between fields and mirrors. In the following example
1005 # .. sourcecode:: text
1007 # #define "${1:mydefine$(upcase yas/text)}"
1009 # ==mydefine== gets automatically upcased to ==MYDEFINE== once you enter
1010 # the field. As you type text, it gets filtered through the
1011 # transformation every time.
1013 # Note that to tell this kind of expression from a mirror with a
1014 # transformation, YASnippet needs extra text between the ==:== and the
1015 # transformation's ==$==. If you don't want this extra-text, you can use
1016 # two ==$=='s instead.
1018 # .. sourcecode:: text
1020 # #define "${1:$$(upcase yas/text)}"
1022 # Please note that as soon as a transformation takes place, it changes
1023 # the value of the field and sets it its internal modification state to
1024 # ==true==. As a consequence, the auto-deletion behaviour of normal
1025 # fields does not take place. This is by design.
1027 # Choosing fields value from a list and other tricks
1028 # --------------------------------------------------
1030 # As mentioned, the field transformation is invoked just after you enter
1031 # the field, and with some useful variables bound, notably
1032 # ==yas/modified-p== and ==yas/moving-away-p==. Because of this
1033 # feature you can place a transformation in the primary field that lets
1034 # you select default values for it.
1036 # The ==yas/choose-value== does this work for you. For example:
1038 # .. sourcecode:: text
1040 # <div align="${2:$$(yas/choose-value '("right" "center" "left"))}">
1044 # See the definition of ==yas/choose-value== to see how it was written
1045 # using the two variables.
1047 # Here's another use, for LaTeX-mode, which calls reftex-label just as
1048 # you enter snippet field 2. This one makes use of ==yas/modified-p==
1051 # .. sourcecode:: text
1053 # \section{${1:"Titel der Tour"}}%
1055 # \label{{2:"waiting for reftex-label call..."$(unless yas/modified-p (reftex-label nil 'dont-
1058 # The function ==yas/verify-value== has another neat trick, and makes
1059 # use of ==yas/moving-away-p==. Try it and see! Also, check out this
1061 # <http://groups.google.com/group/smart-snippet/browse_thread/thread/282a90a118e1b662>=_
1063 # Nested placeholder fields
1064 # -------------------------
1066 # From version 0.6 on, you can also have nested placeholders of the type:
1068 # .. sourcecode:: text
1070 # <div${1: id="${2:some_id}"}>$0</div>
1072 # This allows you to choose if you want to give this ==div== an ==id==
1073 # attribute. If you tab forward after expanding it will let you change
1074 # "some_id" to whatever you like. Alternatively, you can just press
1075 # ==C-d== (which executes ==yas/skip-and-clear-or-delete-char==) and go
1076 # straight to the exit marker.
1078 # By the way, ==C-d== will only clear the field if you cursor is at the
1079 # beginning of the field *and* it hasn't been changed yet. Otherwise, it
1080 # performs the normal Emacs ==delete-char== command.
1082 # Customizable variables
1083 # ======================
1085 # ==yas/trigger-key==
1086 # -------------------
1088 # The key bound to ==yas/expand== when function ==yas/minor-mode== is
1091 # Value is a string that is converted to the internal Emacs key
1092 # representation using ==read-kbd-macro==.
1094 # Default value is =="TAB"==.
1096 # ==yas/next-field-key==
1097 # ----------------------
1099 # The key to navigate to next field when a snippet is active.
1101 # Value is a string that is converted to the internal Emacs key
1102 # representation using ==read-kbd-macro==.
1104 # Can also be a list of keys.
1106 # Default value is =="TAB"==.
1108 # ==yas/prev-field-key==
1109 # ----------------------
1111 # The key to navigate to previous field when a snippet is active.
1113 # Value is a string that is converted to the internal Emacs key
1114 # representation using ==read-kbd-macro==.
1116 # Can also be a list of keys.
1118 # Default value is ==("<backtab>" "<S-tab>)"==.
1120 # ==yas/skip-and-clear-key==
1121 # --------------------------
1123 # The key to clear the currently active field.
1125 # Value is a string that is converted to the internal Emacs key
1126 # representation using ==read-kbd-macro==.
1128 # Can also be a list of keys.
1130 # Default value is =="C-d"==.
1132 # ==yas/good-grace==
1133 # ------------------
1135 # If non-nil, don't raise errors in inline Emacs-lisp evaluation inside
1136 # snippet definitions. An error string "[yas] error" is returned instead.
1138 # ==yas/indent-line==
1139 # -------------------
1141 # The variable ==yas/indent-line== controls the indenting. It is bound
1142 # to =='auto== by default, which causes your snippet to be indented
1143 # according to the mode of the buffer it was inserted in.
1145 # Another variable ==yas/also-auto-indent-first-line==, when non-nil
1146 # does exactly that :-).
1148 # To use the hard-coded indentation in your snippet template, set this
1149 # variable to ==fixed==.
1151 # To control indentation on a per-snippet basis, see also the directive
1152 # ==# expand-env:== in =Writing Snippets=_.
1154 # For backward compatibility with earlier versions of YASnippet, you can
1155 # also place a ==$>== in your snippet, an ==(indent-according-to-mode)==
1156 # will be executed there to indent the line. This only takes effect when
1157 # ==yas/indent-line== is set to something other than =='auto==.
1159 # .. sourcecode:: text
1161 # for (${int i = 0}; ${i < 10}; ${++i})
1166 # ==yas/wrap-around-region==
1167 # --------------------------
1169 # If non-nil, YASnippet will try to expand the snippet's exit marker
1170 # around the currently selected region. When this variable is set to t,
1171 # this has the same effect has using the ===yas/selected-text=== inline
1174 # Because on most systems starting to type deletes the currently
1175 # selected region, this works mostly for snippets with direct
1176 # keybindings or with the ==yas/insert-snippet== command.
1178 # However, when the value is of this variable is ==cua== YASnippet will
1179 # additionally look-up any recently selected that you deleted by starting
1180 # typing. This allows you select a region, type a snippet key (deleting
1181 # the region), then press ==yas/trigger-key== to see the deleted region
1182 # spring back to life inside your new snippet.
1184 # ==yas/triggers-in-field==
1185 # --------------------------
1187 # If non-nil, ==yas/next-field-key== can trigger stacked expansions,
1188 # that is a snippet expansion inside another snippet
1189 # expansion. Otherwise, ==yas/next-field-key== just tries to move on to
1192 # ==yas/snippet-revival==
1193 # -----------------------
1195 # Non-nil means re-activate snippet fields after undo/redo.
1197 # ==yas/after-exit-snippet-hook== and ==yas/before-expand-snippet-hook==
1198 # ----------------------------------------------------------------------
1200 # These hooks are called, respectively, before the insertion of a
1201 # snippet and after exiting the snippet. If you find any strange but
1202 # functional use for them, that's probably a design flaw in YASnippet,
1205 # Importing TextMate snippets
1206 # ===========================
1208 # There are a couple of tools that take TextMate's ".tmSnippet" xml
1209 # files and create YASnippet definitions:
1211 # * =a python script by Jeff Wheeler
1212 # <http://code.nokrev.com/?p=snippet-copier.git;a=blob_plain;f=snippet_copier.py>=_
1215 # <http://yasnippet.googlecode.com/svn/trunk/extras/textmate_import.rb>=_
1216 # , ==textmate_import.rb== adapted from =Rob Christie's
1217 # <http://www.neutronflux.net/2009/07/28/shoulda-snippets-for-emacs/>=_,
1218 # which I have uploaded to the repository.
1220 # In this section, i'll shortly cover the **second** option.
1222 # Download the ==textmate_import.rb== tool and the TextMate
1223 # bundle you're interested in.
1225 # .. sourcecode:: text
1227 # $ curl -O http://yasnippet.googlecode.com/svn/trunk/extras/textmate_import.rb
1228 # $ svn export http://svn.textmate.org/trunk/Bundles/HTML.tmbundle/
1231 # Then invoke ==textmate_import.rb== like this:
1233 # .. sourcecode:: text
1235 # $ ./textmate_import.rb -d HTML.tmbundle/Snippets/ -o html-mode -g HTML.tmbundle/info.plist
1237 # You should end up with a ==html-mode== subdir containing snippets
1238 # exported from textmate.
1240 # .. sourcecode:: text
1242 # $ tree html-mode # to view dir contents, if you have 'tree' installed
1244 # The ==-g== is optional but helps the tool figure out the grouping.
1245 # According to =Organizing Snippets=_, don't forget to touch
1246 # ==.yas-make-groups== and ==.yas-ignore-filename-triggers== inside the
1247 # ==html-mode== dir.
1249 # Also try ==textmate_import.rb --help== for a list of options.
1251 # Please note that snippet importation is not yet perfect. You'll
1252 # probably have some adjustments to some/many snippets. Please
1253 # contribute these adjustments to the google group or, better yet, patch
1254 # the ==textmate_import.rb== to automatically perform them and submit
1257 # .. LocalWords: html YASnippet yas sourcecode pluskid init filenames filename
1258 # .. LocalWords: env varlist keybinding keymap rinari ifndef upcase endif
1259 # .. LocalWords: nondirectory autorelease aValue inline
1261 # * snippet-menu.org
1268 # When ==yas/minor-mode== is active, YASnippet will setup a menu just
1269 # after the "Buffers" menu in the menubar.
1271 # In this menu, you can find
1273 # \* The currently loaded snippet definitions, organized by major mode,
1274 # and optional grouping.
1276 # \* A rundown of the most common commands, (followed by their
1277 # keybindings) including commands to load directories and reload all
1278 # snippet definitions.
1280 # \* A series of submenus for customizing and exploring YASnippet
1283 # .. image:: images/menu-1.png
1286 # Loading snippets from menu
1287 # --------------------------
1289 # Invoking "Load snippets..." from the menu invokes
1290 # ==yas/load-directory== and prompts you for a snippet directory
1291 # hierarchy to load.
1293 # Also useful is the "Reload all" options which uncondionally reloads
1294 # all the snippets directories defined in ==yas/root-directory== and
1295 # rebuilds the menus.
1297 # Snippet menu behavior
1298 # ---------------------
1300 # YASnippet will list in this section all the loaded snippet definitions
1301 # organized by snippet table name.
1303 # You can use this section to explore currently loaded snippets. If you
1304 # click on one of them, the default behavior is to expand it,
1305 # unconditionally, inside the current buffer.
1307 # You can however, customize variable ==yas/visit-from-menu== to be
1308 # ==t== which will take you to the snippet definition file when you
1309 # select it from the menu.
1311 # If you want the menu show only snippet tables whose name corresponds
1312 # to a "real" major mode. You do this by setting ==yas/use-menu== to
1315 # Finally, to have the menu show only the tables for the currently
1316 # active mode, set ==yas/use-menu== to ==abbreviate==.
1318 # These customizations can also be found in the menu itself, under the
1319 # "Snippet menu behavior" submenu.
1322 # Controlling indenting
1323 # ---------------------
1325 # The "Indenting" submenu contains options to control the values of
1326 # ==yas/indent-line== and ==yas/also-auto-indent-first-line==. See
1327 # =Writing snippets <snippet-development.html>=_ .
1332 # The "Prompting method" submenu contains options to control the value
1333 # of ==yas/prompt-functions==. See =Expanding snippets <snippet-expansion.html>=_ .
1338 # The "Misc" submenu contains options to control the values of more
1349 # ============================
1350 # Frequently Asked Questions
1351 # ============================
1353 # Why is there an extra newline?
1354 # ==============================
1356 # If you have a newline at the end of the snippet definition file, then
1357 # YASnippet will add a newline when you expanding a snippet. Please
1358 # don't add a newline at the end if you don't want it when you saving
1361 # Note some editors will automatically add a newline for you. In Emacs,
1362 # if you set ==require-final-newline== to ==t==, it will add the final
1363 # newline for you automatically.
1365 # Why doesn't TAB expand a snippet?
1366 # =================================
1368 # First check the mode line to see if there's ==yas==. If not, then try
1369 # ==M-x yas/minor-mode== to manually turn on the minor mode and try to
1370 # expand the snippet again. If it works, then, you can add the following
1371 # code to your ==.emacs== *before* loading YASnippet:
1373 # .. sourcecode:: lisp
1375 # (add-hook 'the-major-mode-hook 'yas/minor-mode-on)
1377 # where ==the-major-mode== is the major mode in which ==yas/minor-mode==
1378 # isn't enabled by default.
1380 # From YASnippet 0.6 you can also use the command ==M-x
1381 # yas/global-mode== to turn on YASnippet automatically for *all* major
1384 # If ==yas/minor-mode== is on but the snippet still not expanded. Then
1385 # try to see what command is bound to the ==TAB== key: press ==C-h k==
1386 # and then press ==TAB==. Emacs will show you the result.
1388 # You'll see a buffer prompted by Emacs saying that ==TAB runs the
1389 # command ...==. Alternatively, you might see ==<tab> runs the command
1390 # ...==, note the difference between ==TAB== and ==<tab>== where the
1391 # latter has priority. If you see ==<tab>== bound to a command other
1392 # than ==yas/expand==, (e.g. in ==org-mode==) you can try the following
1393 # code to work around:
1395 # .. sourcecode:: lisp
1397 # (add-hook 'org-mode-hook
1398 # (let ((original-command (lookup-key org-mode-map [tab])))
1400 # (setq yas/fallback-behavior
1401 # '(apply ,original-command))
1402 # (local-set-key [tab] 'yas/expand))))
1404 # replace ==org-mode-hook== and ==org-mode-map== with the major mode
1405 # hook you are dealing with (Use ==C-h m== to see what major mode you
1408 # As an alternative, you can also try
1410 # .. sourcecode:: lisp
1412 # (defun yas/advise-indent-function (function-symbol)
1413 # (eval =(defadvice ,function-symbol (around yas/try-expand-first activate)
1415 # "Try to expand a snippet before point, then call =%s' as usual"
1417 # (let ((yas/fallback-behavior nil))
1418 # (unless (and (interactive-p)
1422 # (yas/advise-indent-function 'ruby-indent-line)
1424 # To *advise* the modes indentation function bound to TAB, (in this case
1425 # ==ruby-indent-line==) to first try to run ==yas/expand==.
1427 # If the output of ==C-h k RET <tab>== tells you that ==<tab>== is
1428 # indeed bound to ==yas/expand== but YASnippet still doesn't work, check
1429 # your configuration and you may also ask for help on the =discussion
1430 # group <http://groups.google.com/group/smart-snippet>=_. See this
1431 # particular =thread
1432 # <http://code.google.com/p/yasnippet/issues/detail?id=93&can=1>=_ for
1433 # quite some solutions and alternatives.
1435 # Don't forget to attach the information on what command is bound to TAB
1436 # as well as the mode information (Can be obtained by ==C-h m==).
1438 # Why doesn't TAB navigation work with flyspell
1439 # =============================================
1441 # A workaround is to inhibit flyspell overlays while the snippet is active:
1443 # .. sourcecode:: lisp
1445 # (add-hook 'flyspell-incorrect-hook
1446 # #'(lambda (dummy1 dummy2 dymmy3)
1447 # (and yas/active-field-overlay
1448 # (overlay-buffer yas/active-field-overlay))))
1450 # This is apparently related to overlay priorities. For some reason, the
1451 # ==keymap== property of flyspell's overlays always takes priority over
1452 # the same property in yasnippet's overlays, even if one sets the
1453 # latter's ==priority== property to something big. If you know
1454 # emacs-lisp and can solve this problem, drop a line in the =discussion
1457 # How do I turn off the minor mode where in some buffers
1458 # ======================================================
1460 # The best way, since version 0.6.1c, is to set the default value of the
1461 # variable ==yas/dont-activate== to a lambda function like so:
1463 # .. sourcecode:: lisp
1465 # (set-default 'yas/dont-activate
1467 # (and yas/root-directory
1468 # (null (yas/get-snippet-tables)))))
1470 # This is also the default value starting for that version. It skips the
1471 # minor mode in buffers where it is not applicable (no snippet tables),
1472 # but only once you have setup your yas/root-directory.
1475 # How do I define an abbrev key containing characters not supported by the filesystem?
1476 # ====================================================================================
1478 # \**Note**: This question applies if you're still defining snippets
1479 # whose key *is* the filename. This is behavior stil provided by
1480 # version 0.6 for backward compatibilty, but is somewhat deprecated...
1482 # For example, you want to define a snippet by the key ==<== which is
1483 # not a valid character for filename on Windows. This means you can't
1484 # use the filename as a trigger key in this case.
1486 # You should rather use the ==# key:== directive to specify the key of
1487 # the defined snippet explicitly and name your snippet with an arbitrary
1488 # valid filename, ==lt.yasnippet== for example, using ==<== for the
1489 # ==# key:== directive:
1491 # .. sourcecode:: text
1494 # # name: <...></...>
1498 # .. _discussion group: http://groups.google.com/group/smart-snippet
1505 # .. _Organizing Snippets: snippet-organization.html
1506 # .. _Expanding Snippets: snippet-expansion.html
1507 # .. _Writing Snippets: snippet-development.html
1508 # .. _The YASnippet Menu: snippet-menu.html
1510 # 0.7.0b / ????-??-??
1511 # ===================
1513 # \* Filenames can no longer be snippet triggers. Please upgrade your snippet
1517 # 0.6.1c / 2009-08-13
1518 # ===================
1520 # \* Fixed =issues <http://code.google.com/p/yasnippet/issues>=_ 99, 98, 93,
1521 # 90, 91, 88, 87. Thanks everybody.
1522 # \* More compliant customization group =Issue94
1523 # <http://code.google.com/p/yasnippet/issues/detail?id=94>=_, (thanks
1525 # \* Added workaround for issue 97 in the FAQ
1526 # \* Small updates to documentation.
1528 # 0.6.1b / 2009-08-29
1529 # ===================
1531 # \* Much more powerful menu. See =The YASnippet menu=_.
1532 # \* New ways to organize snippets. See =Organizing snippets=_.
1533 # \* Added ==yas/also-auto-indent-first-line== customization variable.
1534 # \* Renamed directive ==# env:== to ==# expand-env:==
1535 # \* Rewrote much of the documentation.
1536 # \* Added TextMate import tool ==textmate-import.rb== to to svn
1537 # repository (see "extras/")
1538 # \* Added *experimental* bundle of textmate snippets
1539 # ==yasnippet-textmate-bundle.el==
1540 # \* Fixed =Issue 74
1541 # <http://code.google.com/p/yasnippet/issues/detail?id=74>=_ (thanks
1542 # rmartin.k...@gmail.com)
1543 # \* Fixed =Issues 80 through 84
1544 # <http://code.google.com/p/yasnippet/issues/detail?id=80>=_ (thanks
1546 # \* Fixed many more issues...
1549 # 0.6.0c / 2009-07-27
1550 # ===================
1552 # \* Now byte compiles correctly with no warnings.
1553 # \* Fixed =Issue 68
1554 # <http://code.google.com/p/yasnippet/issues/detail?id=68>=_ with
1555 # mouse-clicking alternatives in ==ido-mode==.
1556 # \* Added ==yas/also-auto-indent-first-line== customization variable.
1559 # 0.6.0b / 2009-07-25
1560 # ===================
1562 # \* Nested placeholders of the type ==<div${1: id="${2:someid}"}> $0==.
1564 # \* More robust undo/redo support.
1566 # \* Stacked snippet expansion (*snippet in snippet*).
1568 # \* Transformation on a primary field with syntax ==${1:default$(transform)}==
1570 # \* Validations on field exit through the ==yas/verify-value==
1571 # primary field transformation.
1573 # \* Wrapping the region in the exit marker ==$0== of the snippet. Use
1574 # ==yas/wrap-around-region==.
1576 # \* Auto-indentation. Use ==yas/indent-line== set to =='auto==
1578 # \* Easier definition of snippets. Use ==yas/find-snippets== or
1579 # ==yas/visit-snippet-file==. In the new ==snippet-mode== use
1580 # ==yas/load-snippet-buffer== and ==yas/tryout-snippet==.
1582 # \* Customization group ==yasnippet==.
1584 # \* Overriding customization variables in snippets. Use the ==env:
1585 # let-form== template keyword.
1587 # \* Fixed =Issue 60
1588 # <http://code.google.com/p/yasnippet/issues/detail?id=60>=_
1589 # \* Fixed =Issue 65
1590 # <http://code.google.com/p/yasnippet/issues/detail?id=65>=_
1591 # \* Fixed =Issue 56
1592 # <http://code.google.com/p/yasnippet/issues/detail?id=56>=_
1594 # 0.5.10 / 2009-02-11
1595 # ===================
1597 # \* Added *grouping* support so that the snippets in the menu can be
1598 # groupped together.
1599 # \* Make the bundle =ELPA <http://tromey.com/elpa/index.html>=_
1602 # 0.5.9 / 2009-01-21
1603 # ==================
1605 # \* Fixed the bug of disabling the auto-indenting of ==cc-mode==.
1607 # 0.5.8 / 2009-01-15
1608 # ==================
1610 # \* Added a ==key== property in snippet definition for snippet names
1611 # that are not valid path name.
1612 # \* Fixed some bugs of indenting (=Issue 44
1613 # <http://code.google.com/p/yasnippet/issues/detail?id=44>=_, =Issue
1614 # 46 <http://code.google.com/p/yasnippet/issues/detail?id=46>=_).
1615 # \* Fixed =Issue 45
1616 # <http://code.google.com/p/yasnippet/issues/detail?id=45>=_ by
1617 # providing a proper default value for ==yas/buffer-local-condition==.
1618 # \* Added helper function ==yas/substr== for convenient mirror
1620 # \* Make variable ==yas/registered-snippet== properly initialized.
1621 # \* Fixed the overlay error when overlay becomes empty (=Issue 49
1622 # <http://code.google.com/p/yasnippet/issues/detail?id=49>=_ and
1624 # <http://code.google.com/p/yasnippet/issues/detail?id=48>=_). This
1625 # bug has occurred and been fixed earlier, and should not have
1626 # happened if we have proper regression test.
1627 # \* Added a workaround for ==c-electric-== serial commands (=Issue 27
1628 # <http://code.google.com/p/yasnippet/issues/detail?id=27>=_).
1630 # 0.5.7 / 2008-12-03
1631 # ==================
1633 # \* Fixed =Issue 28
1634 # <http://code.google.com/p/yasnippet/issues/detail?id=28>=_ of
1635 # properly clean up snippet (by joaotavora).
1636 # \* Added a new section "Field-level undo functionality" to correct
1637 # =Issue 33 <http://code.google.com/p/yasnippet/issues/detail?id=33>=_
1639 # \* Added some snippets from users for sql, erlang, scala, html, xml, latex, etc.
1640 # \* Fixed =Issue 16
1641 # <http://code.google.com/p/yasnippet/issues/detail?id=16>=_ by adding
1642 # ==$>== support. Here's the =doc for $> indenting
1643 # <http://pluskid.lifegoo.com/upload/project/yasnippet/doc/define_snippet.html#indenting>=_.
1645 # 0.5.6 / 2008-08-07
1646 # ==================
1648 # \* Added a buffer local variable ==yas/dont-activate== to turn off
1649 # ==yas/minor-mode== in some major modes. See =Issue 29
1650 # <http://code.google.com/p/yasnippet/issues/detail?id=29>=_.
1651 # \* Make the environment of elisp evaluation more friendly to
1652 # ==(current-column)==.
1653 # \* Fixed the regular expression bug in python-mode snippets.
1654 # \* Use filename or full key extension for snippet name if no ==name==
1655 # property is defined.
1657 # 0.5.5 / 2008-05-29
1658 # ==================
1660 # \* Tweak ==yas/extra-mode-hooks== so that it can be more easily
1662 # \* Add an entry in FAQ about why ==TAB== key doesn't work in some
1665 # 0.5.4 / 2008-05-15
1666 # ==================
1668 # \* Added ==ox-mode-hook== and ==python-mode-hook== to
1669 # ==yas/extra-mode-hooks== to fix the problem YASnippet is not enabled
1672 # 0.5.3 / 2008-05-07
1673 # ==================
1675 # \* Fix indent of python-mode snippets.
1676 # \* Fix a bug of dropdown-list: conflicts with color-theme (=Issue 23
1677 # <http://code.google.com/p/yasnippet/issues/detail?id=23>=_). Thanks
1679 # \* Fix a bug of condition system.
1681 # 0.5.2 / 2008-04-20
1682 # ==================
1684 # \* Fix a bug for comparing string to symbol using ==string=== (which
1685 # will fire an error).
1687 # 0.5.1 / 2008-04-14
1688 # ==================
1690 # \* Use a beautiful css style in the document.
1692 # 0.5.0 / 2008-04-10
1693 # ==================
1695 # \* Integrate with hippie-expand. Just add ==yas/hippie-try-expand== to
1696 # ==hippie-expand-try-functions-list==.
1697 # \* If you set ==yas/fall-back-behavior== to =='return-nil==, YASnippet
1698 # will return nil when it can't find a snippet to expand.
1699 # \* Defect fix: the condition of a snippet was evaluated twice in
1701 # \* Deleting snippet (using ==C-w== or ==C-k==) won't cause serious
1703 # \* Several complex snippet for python-mode from Yasser included in the
1706 # 0.4.5 / 2008-04-07
1707 # ==================
1709 # \* Merge the latest dropdown-list.el.
1710 # \* Add snippets for f90-mode from Li Zhu.
1711 # \* Bug fix: l-safe-expr-p: Lisp nesting exceeds ==max-lisp-eval-depth==
1712 # error when several (more than two) snippets overlaps. Thanks
1713 # sunwaybupt@newsmth for reporting this bug.
1715 # 0.4.4 / 2008-03-24
1716 # ==================
1718 # \* Bug fix: dropdown-list.el doesn't recognize [return] properly.
1720 # 0.4.3 / 2008-03-23
1721 # ==================
1723 # \* Bug fix: failed to recognize user customized yas/trigger-key.
1725 # 0.4.2 / 2008-03-22
1726 # ==================
1728 # \* Make a separate document package for release. Also make document
1731 # 0.4.1 / 2008-03-21
1732 # ==================
1734 # \* Make sure ==yas/minor-mode=='s key bindings always take priority to
1735 # other minor modes.
1737 # 0.4.0 / 2008-03-20
1738 # ==================
1740 # \* Document refinement and released with YASnippet. Most of the Online
1741 # wiki document will be deprecated soon.
1742 # \* Powerful condition system added to yasnippet!
1743 # \* Incorporate ==dropdown-list.el== and make it default way for
1744 # selecting multiple candidates. Thanks to =Jaeyoun Chung
1745 # <http://groups.google.com/group/smart-snippet/browse_thread/thread/c869158b76addeb3/e7c6372ba457189e>=_.
1746 # \* yas/before-expand-snippet-hook
1748 # 0.3.2 / 2008-03-19
1749 # ==================
1751 # \* Enhancement: A better way to define minor-mode. Thanks to Kentaro
1752 # Kuribayashi. See =this thread
1753 # <https://groups.google.com/group/smart-snippet/browse_thread/thread/65cb3b5583eda887?hl=en>=_
1756 # 0.3.1 / 2008-03-17
1757 # ==================
1759 # \* Bug fix: Emacs get confused when a field is deleted. See =issue 10
1760 # <http://code.google.com/p/yasnippet/issues/detail?id=10>=_.
1762 # 0.3.0 / 2008-03-16
1763 # ==================
1765 # \* Add a ==yas/after-exit-snippet-hook== so that you can do something like
1766 # ==indent-region== or ==fill-region== after finish the snippet.
1767 # \* Use minor-mode instead of ==global-set-key== to bind the trigger
1768 # key. Now the trigger key and fall-back behavior can be more
1769 # flexible. Not constrained to ==<tab>==. Thanks to Trey Jackson. See
1771 # <https://groups.google.com/group/smart-snippet/browse_thread/thread/937f32a2a6dea4f2?hl=en>=_
1773 # \* Now user can customize the popup function for selecting multiple
1774 # candidate for the same snippet key.
1775 # \* Support ==dropdown-list.el== to be a better way to select multiple
1776 # candidate when in text mode.
1778 # 0.2.3 / 2008-03-15
1779 # ==================
1781 # \* Bug in non-window (-nw) mode when there's multiple candidate to
1782 # expand. See =issue 7
1783 # <http://code.google.com/p/yasnippet/issues/detail?id=7>=_.
1784 # \* Allow expanding another snippet as long as not currently inside a
1787 # 0.2.2 / 2008-03-13
1788 # ==================
1790 # \* Added customized face for fields and mirrors. Better in dark
1791 # background. And users can customize it.
1793 # 0.2.1 / 2008-03-10
1794 # ==================
1796 # \* Fix the insert-behind problem under both Emacs 22 and Emacs 23.
1798 # 0.2.0 / 2008-03-10
1799 # ==================
1801 # \* Use big keymap overlay to detect ==insert-behind== event manually to
1802 # avoid sometimes missed hook calls. See =issue 3
1803 # <http://code.google.com/p/yasnippet/issues/detail?id=3>=_ for more
1805 # \* Support parent snippet table. Now you can set (for example)
1806 # ==cc-mode== as common mode for ==c++-mode==, ==c-mode== and
1807 # ==java-mode==. They'll share snippets defined for ==cc-mode==.
1809 # 0.1.1 / 2008-03-08
1810 # ==================
1812 # \* Add a rake task to upload to google code.
1813 # \* Use elisp compile-bundle function instead of python scrip
1815 # 0.1.0 / 2008-03-07
1816 # ==================
1818 # \* Embedded elisp support.
1819 # \* Fields navigation support.
1820 # \* Mirror of fields support.
1821 # \* Menu-bar support.
1822 # \* Multiple snippets with same name support.
1823 # \* Popup menu for multiple snippet with same name support.
1824 # \* Transformation of fields support.
1825 # \* Load directory support.
1826 # \* Compile bundle support.