26 Commits

Author SHA1 Message Date
Stefan Monnier
1d0966ae34 * yasnippet.el (yas-buffer-local-condition): Accept functions
(yas-not-string-or-comment-condition): Make it a function.
(yas--funcall-condition): Rename from `yas--funcall-condition`, change
its calling convention.
(yas--template-can-expand-p, yas--describe-pretty-table):
Adjust accordingly.
(yas--require-template-specific-condition-p): Add support for functions
in `yas-buffer-local-condition`.

* doc/snippet-expansion.org (The condition system <<condition-system>>):
Adjust example to avoid quoted code.
2024-01-19 12:38:21 -05:00
João Távora
849a134c2d Unbreak link in org docs
* doc/snippet-expansion.org: Fix a link
2023-09-05 02:03:14 +01:00
Noam Postavsky
845222774b Consider fundamental-mode as ultimate ancestor
* yasnippet.el (yas--modes-to-activate): If a mode doesn't have a
`derived-mode-parent' property, use `fundamental-mode'.
* yasnippet-tests.el (loading-with-cyclic-parenthood)
(issue-492-and-494): Expect fundamental-mode to be active.
* doc/snippet-expansion.org (Eligible snippets): Mention that
fundamental-mode is a fallback parent mode.
2018-10-13 17:02:10 -04:00
Noam Postavsky
e261832b1a Add some styling to doc, improve top menu
* doc/snippet-expansion.org:
* doc/snippet-organization.org: Fix typos.
* doc/stylesheets/manual.css: Add some simple styling.  Mainly, this
sets 'max-width' for the main text, and centers it.  Adjust the
background color.
* doc/nav-menu.html.inc: Adjust 'class' of top menu.
* doc/yas-doc-helper.el (yas--make-preamble): New function, used for
:html-preamble.  It sets the element for the current page in the top
menu as bolded text to aid navigation.
* doc/stylesheets/styles.css: Remove, it was unused since the old rst
manual was removed.
2018-03-04 19:02:24 -05:00
Noam Postavsky
0afc638e16 Fix docs for new org mode
* Rakefile: Comment to remind me how to run it.
* doc/snippet-expansion.org:
* doc/snippet-menu.org: It seems org 9.x got a bit stricter about link
formatting.  Cross-file links *must* use the 'file:' prefix.
* doc/yas-doc-helper.el (yas--document-symbol): Org 9.x also got a bit
more strict about empty lines between a node and its property list.
Make sure not to put a blank line between variable nodes and the
property list.
2018-03-04 18:56:26 -05:00
Noam Postavsky
8797a31337 * doc/snippet-expansion.org: Complete sentence fragment. 2017-04-20 21:00:22 -04:00
Noam Postavsky
14819c931f Make yas-buffer-local-condition into a defcustom
* yasnippet.el (yas-not-string-or-comment-condition): New constant,
holding the previous default value of `yas-buffer-local-condition'.
(yas-buffer-local-condition): Make into defcustom.
2017-02-16 22:27:15 -05:00
Noam Postavsky
4f37afd493 Let snippets expand in strings/comments by default
* yasnippet.el (yas-buffer-local-condition): Change default to t.
* doc/snippet-expansion.org: Update documentation.
2017-02-16 22:27:15 -05:00
Noam Postavsky
0311fe2619 Use :filter instead of yas--fallback
Instead of making yas-expand and yas-expand-from-keymap search for the
command that would have been called, use a conditional keybinding so the
Emacs' builtin keybinding lookup code will do the searching instead.

* doc/faq.org: Remove section about old method binding method.  Update
example to use new method.
* doc/snippet-expansion.org (Trigger key): Update explanation for new
method.
* yasnippet.el (yas-fallback-behavior): Mark obsolete.
(yas--maybe-expand-key-filter): New function.
(yas-maybe-expand): New conditional binding.
(yas-minor-mode-map): Bind it to TAB and <tab>.
(yas--maybe-expand-from-keymap-filter): New function, extracted from
`yas-expand-from-keymap'.
(yas-maybe-expand-from-keymap): New conditional binding.
* yasnippet-tests.el (yas--key-binding): New function, like
`key-binding' but overrides `this-command-keys-vector'.
(snippet-load-uuid): Use it.
(test-yas-tab-binding, test-yas-in-org): Insert snippet key before
testing binding.
2017-01-08 21:30:00 -05:00
Sudarshan Gaikaiwari
7e0a0de499 Use new name of python-in-string/comment in docs
* doc/snippet-expansion.org:
* yasnippet.el (yas-buffer-local-condition): python.el renames
python-in-string/comment to python-syntax-comment-or-string-p.  Modify
the documentation to reflect that.

Copyright-paperwork-exempt: yes

Close #725
2016-07-23 08:10:48 -04:00
Noam Postavsky
5d44a9f15e Revert "Disable region wrapping for trigger key expansion"
This reverts commit f8d1af1f50f42ac1689c583c152c3b15e8774ae4.

Disabling this for trigger key introduced an inconsistency that is more
complicated to implement and document than simply fixing region wrapping
for trigger key expanded snippets.
2016-04-30 20:17:38 -04:00
Noam Postavsky
e37ce9e488 Disable region wrapping for trigger key expansion
It's too awkward to highlight the relevant text while maneuvering point
in front of the trigger key.

* yasnippet.el (yas-expand-from-trigger-key): Let-bind
yas-wrap-around-region to nil if it was t.
* doc/snippet-expansion.org: Document it.
2016-04-30 20:10:01 -04:00
Noam Postavsky
c1b2cb7c5e Improve documentation for new register option
* doc/snippet-expansion.org: Add new section about
yas-wrap-around-region.
* yasnippet.el (yas-wrap-around-region): Improve docstring.
2016-04-30 20:10:01 -04:00
Noam Postavsky
7bce1a6473 Add new function yas-lookup-snippet
* yasnippet.el (yas-lookup-snippet): New function.
(yas--get-snippet-tables, yas--modes-to-activate): Add optional mode
parameter.
* yasnippet-tests.el (snippet-lookup): New test for yas-lookup-snippet.
* doc/snippet-expansion.org (Expanding from emacs-lisp code): Mention
  yas-lookup-snippet.
2015-08-03 10:36:46 -04:00
Noam Postavsky
5ebf347392 Minor doc fixes
* doc/snippet-expansion.org (Expanding from emacs-lisp code): Fix typo.
* doc/snippet-menu.org (Controlling indenting, Prompting method): Remove
  incorrect whitespace.
2015-08-03 10:29:42 -04:00
Noam Postavsky
24d7a67932 fix typo 2013-12-24 11:14:39 -05:00
Joao Tavora
582e3680b6 minor: cosmetic fixes to manual 2013-12-02 19:28:56 +00:00
Noam Postavsky
07b1d3925c move #+STARTUP to org-setup.inc; add #+LINK_HOME
also remove #+AUTHOR since it ends up refering to the generator, not the
actual author.
2013-11-26 23:09:18 -05:00
Noam Postavsky
0aebb41aca move top heading to title
and all the other headings one level up. Except for
snippet-reference.org; yas--document-symbols doesn't quite work right in
that case, fix it later.
2013-11-26 23:09:17 -05:00
Noam Postavsky
eaeb6ff7a9 more links to docstrings, don't repeat docstrings 2013-11-26 23:09:17 -05:00
Noam Postavsky
08a44b43dc add code examples for snippet-expansion.rst
pandoc org -> rst drops them
2013-11-26 23:09:17 -05:00
Noam Postavsky
8f1fa089fb replace obsolete refs
yas-trigger-key -> bind yas-expand
yas-mode-symbol -> call yas-activate-extra-mode
2013-11-26 23:09:17 -05:00
Noam Postavsky
2f7bb6c751 move images to the section they describe 2013-11-26 23:09:17 -05:00
Noam Postavsky
e46d9c7410 link to docstring ref; fix other links, formatting 2013-11-26 23:09:17 -05:00
Noam Postavsky
7b82424735 move index.org subsection into snippet-expansion.org 2013-11-26 23:09:16 -05:00
Noam Postavsky
f6cace08f3 convert old rst manuals to org mode
This is just the initial conversion with pandoc, they still need to be
fixed up. Also define new org files as a project in yas-doc-helper.el.
2013-11-26 23:09:16 -05:00