[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 08a44b4 050/177: add code examples for snippet-expansion.r
From: |
João Távora |
Subject: |
[elpa] master 08a44b4 050/177: add code examples for snippet-expansion.rst |
Date: |
Sat, 28 Mar 2015 15:40:45 +0000 |
branch: master
commit 08a44b43dc7074dbf4baed538849bbfaafc81908
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
add code examples for snippet-expansion.rst
pandoc org -> rst drops them
---
doc/snippet-expansion.org | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/doc/snippet-expansion.org b/doc/snippet-expansion.org
index 54a212f..53e6ad5 100644
--- a/doc/snippet-expansion.org
+++ b/doc/snippet-expansion.org
@@ -109,6 +109,10 @@ As with expanding from the menubar, the condition system
and multiple
candidates doesn't affect expansion. In fact, expanding from the
YASnippet menu has the same effect of evaluating the follow code:
+#+BEGIN_SRC emacs-lisp
+ (yas-expand-snippet template)
+#+END_SRC
+
See the internal documentation on
[[sym:yas-expand-snippet][=yas-expand-snippet=]] for more
information.
@@ -144,7 +148,15 @@ In particular, the following things matter:
Use [[#yas-activate-extra-mode][=yas-activate-extra-mode=]] to consider
snippet tables whose name
does not correspond to a major mode. Typically, you call this from
- a minor mode hook.
+ a minor mode hook, for example:
+
+#+BEGIN_SRC emacs-lisp
+ ;; When entering rinari-minor-mode, consider also the snippets in the
+ ;; snippet table "rails-mode"
+ (add-hook 'rinari-minor-mode-hook
+ #'(lambda ()
+ (yas-activate-extra-mode 'rails-mode)))
+#+END_SRC
- Buffer-local
[[sym:yas-buffer-local-condition][=yas-buffer-local-condition=]] variable
@@ -206,6 +218,15 @@ story and look at the rules:
In the mentioned scenario, set
[[sym:yas-buffer-local-condition][=yas-buffer-local-condition=]] like this
+#+BEGIN_SRC emacs-lisp
+ (add-hook 'python-mode-hook
+ (lambda ()
+ (setq yas-buffer-local-condition
+ '(if (python-in-string/comment)
+ '(require-snippet-condition . force-in-comment)
+ t))))
+#+END_SRC
+
... and specify the condition for a snippet that you're going to expand
in comment to be evaluated to the symbol =force-in-comment=. Then it can
be expanded as you expected, while other snippets like =if= still can't
@@ -225,6 +246,10 @@ You can customize it with
=M-x customize-variable RET yas-prompt-functions RET=. Alternatively you
can put in your emacs-file:
+#+BEGIN_SRC emacs-lisp
+ (setq yas-prompt-functions '(yas-x-prompt yas-dropdown-prompt))
+#+END_SRC
+
Currently there are some alternatives solution with YASnippet.
**** Use the X window system
- [elpa] master 81e26b4 039/177: Merge pull request #431 from ignisf/update-snippet-submodules, (continued)
- [elpa] master 81e26b4 039/177: Merge pull request #431 from ignisf/update-snippet-submodules, João Távora, 2015/03/28
- [elpa] master c7c6516 040/177: don't use link abbreviations, João Távora, 2015/03/28
- [elpa] master d451fef 041/177: rename manual.org to index.org, João Távora, 2015/03/28
- [elpa] master 5acc976 043/177: split symbol reference into separate file, João Távora, 2015/03/28
- [elpa] master fd8423c 045/177: fix links, João Távora, 2015/03/28
- [elpa] master 7b82424 046/177: move index.org subsection into snippet-expansion.org, João Távora, 2015/03/28
- [elpa] master 3002594 037/177: Merge pull request #430 from npostavs/org-doc, João Távora, 2015/03/28
- [elpa] master 875ef77 044/177: move index.org subsection into snippet-organization.org, João Távora, 2015/03/28
- [elpa] master 2f7bb6c 048/177: move images to the section they describe, João Távora, 2015/03/28
- [elpa] master 8f1fa08 049/177: replace obsolete refs, João Távora, 2015/03/28
- [elpa] master 08a44b4 050/177: add code examples for snippet-expansion.rst,
João Távora <=
- [elpa] master dfdb89c 054/177: remove erroneous #+BEGIN/END_QUOTE, João Távora, 2015/03/28
- [elpa] master eaeb6ff 051/177: more links to docstrings, don't repeat docstrings, João Távora, 2015/03/28
- [elpa] master 07b1d39 056/177: move #+STARTUP to org-setup.inc; add #+LINK_HOME, João Távora, 2015/03/28
- [elpa] master fd3fa39 057/177: publish org doc from Rakefile, João Távora, 2015/03/28
- [elpa] master 2c237cc 060/177: check function doc before variable doc, João Távora, 2015/03/28
- [elpa] master eaa3141 059/177: fix docstring extraction for "fancy" docs, João Távora, 2015/03/28
- [elpa] master 8d7c9a6 058/177: retrieve function documentation correctly, João Távora, 2015/03/28
- [elpa] master 63873e7 052/177: snippet-menu.org: links, formatting, obsolete refs, João Távora, 2015/03/28
- [elpa] master e46d9c7 047/177: link to docstring ref; fix other links, formatting, João Távora, 2015/03/28
- [elpa] master 860858d 061/177: Merge pull request #436 from npostavs/autodoc-1, 2, João Távora, 2015/03/28