992 Commits

Author SHA1 Message Date
Noam Postavsky
f12164551f Fix #607; avoid Emacs bug #21824
See also
- https://github.com/capitaomorte/yasnippet/issues/607
- http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21824

* yasnippet.el (yas--on-field-overlay-modification): Do nothing if
  yas--active-field-overlay is not an overlay.
2015-11-03 22:16:17 -05:00
Noam Postavsky
fb28ec8384 * README.mdown (Use yas-minor-mode): Reword.
Close #623.
2015-11-01 18:36:08 -05:00
Noam Postavsky
cd05da61f9 Activate extra and major modes first
This prevents snippets from a parent mode from overriding those of the
major-mode's (or yas--extra-modes).  Snippets of ancestor modes may
still override snippets of some other ancestor modes, but hopefully this
won't cause much trouble in practice.

See [1] and subsequent comments.

[1]: https://github.com/capitaomorte/yasnippet/issues/619#issuecomment-149127150

* yasnippet.el (yas--modes-to-activate): Reverse result, so that parents
  of yas--extra-modes and major are later in the list.
* yasnippet-tests.el (loading-with-cyclic-parenthood)
(extra-modes-parenthood): Test it.

Close #626.
2015-11-01 18:35:52 -05:00
Noam Postavsky
b8687bb0fe Avoid double snippet loading messages
* yasnippet.el (yas--load-directory-1): Message about loading compiled
  snippets only after successfully doing so.

Close #627.
2015-11-01 18:35:28 -05:00
Noam Postavsky
b055f132be Fix #617; ensure point is visible before x prompt
* yasnippet.el (yas-x-prompt): Call redisplay.
2015-10-21 18:39:40 -04:00
Noam Postavsky
35642ac007 Simplify string matching.
* yasnippet.el (yas--field-parse-create): Use string-match-p to instead
  of save-match-data, anchor regexp with \` (start of string) to instead
  of (eq ... 0)
2015-10-11 21:23:36 -04:00
Noam Postavsky
72c6c4cd7b Fix #618; save match data in yas--scan-sexps
* yasnippet.el (yas--scan-sexps): Save match data.
2015-10-11 21:18:52 -04:00
Noam Postavsky
b6d924c83d * yasnippet.el (yas--scan-sexps): Use ignore-errors. 2015-10-11 21:17:50 -04:00
Noam Postavsky
ac3fe83247 Merge pull request #621 from npostavs/dfs-extra-modes2
find parents for extra-modes too (v2)
2015-10-11 14:51:56 -04:00
Noam Postavsky
fb6ec67228 Fix #619; find parents for extra-modes too
* yasnippet.el (yas--modes-to-activate): Call dfs on yas--extra-modes as
  well.
2015-10-11 13:09:00 -04:00
Noam Postavsky
e56aa6f7b3 Build a single `explored' list.
* yasnippet.el (yas--modes-to-activate): Make helper dfs function
  produce the list of modes only by updating a single `explored' list,
  instead of building up the list by value and having to remove
  duplicated after.
2015-10-11 13:08:59 -04:00
Noam Postavsky
00b84ceaf4 Add (failing) yas--modes-to-activate test
* yasnippet-tests.el (extra-modes-parenthood): New (failing) test.
(loading-with-cyclic-parenthood): Use equal + sort instead of set
operation + length.
2015-10-11 13:08:53 -04:00
George Balatsouras
710ea4d106 Update snippets module 2015-10-05 02:57:27 +03:00
Noam Postavsky
8df6a6ed8e Fix invalid yas-key-syntaxes element warning
* yasnippet.el (yas--templates-for-key-at-point): Fix infinite loop and
  remove redundant "Warning" in the bad element warning.
2015-09-27 20:16:28 -04:00
Noam Postavsky
7703a55ac4 * doc/snippet-organization.org (.yas-skip): Add info. 2015-09-24 21:12:30 -04:00
Noam Postavsky
01139a2deb * yasnippet.el (yas--define-snippets-2): Use file-name-NONdirectory. 2015-09-12 16:30:01 -04:00
Noam Postavsky
041821a210 * yasnippet-tests.el (string-suffix-p): Define for older Emacsen. 2015-09-05 16:20:04 -04:00
Noam Postavsky
e3f03cabe0 Test visiting compiled snippets
* yasnippet-tests.el (visiting-compiled-snippets): New Test.
* yasnippet.el (yas--lookup-snippet-1, yas-lookup-snippet): Split new
  function yas--lookup-snippet-1 from yas-lookup-snippet.
2015-09-05 15:42:32 -04:00
Noam Postavsky
68b0ab66ca Accept documented snippet list formats
yas-define-snippets was making assumptions that happended to be true for
its current calls, but could fail if given differently formatted snippet
lists that still meet the docstring description.

* yasnippet.el (yas-define-snippets): Handle incomplete snippet lists.
2015-09-05 15:42:32 -04:00
Noam Postavsky
215ad9bcf2 Fix #597; use SAVE-FILE to visit compiled snippets
Rename the existing FILE field to LOAD-FILE, and add a new SAVE-FILE to
yas--template struct.  Normally they will be the same, but compiled
snippets have only SAVE-FILE because they are loaded by "compiled" code.

* yasnippet.el (yas--template): Remove field file, add load-file and
  save-file.
(yas--parse-template): Update snippet-definition list in docstrings.
(yas-define-snippets): Move LOAD-FILE value to SAVE-FILE when compiling.
(yas--template-get-file): New function.
(yas--visit-snippet-file-1, yas-load-snippet-buffer,
yas-load-snippet-buffer-and-close): Use yas--template-load-file,
yas--template-save-file, or yas--template-get-file, as appropriate.
* doc/snippet-organization.org (The =.yas-compiled-snippet.el= file):
  Remove caveat that is no longer relevant.
2015-09-05 15:41:05 -04:00
Noam Postavsky
cc1c758ab7 Reorganize snippet construction from list code
* yasnippet.el (yas--template): New yas--define-snippets-2 constructor
  with arguments matching yas-define-snippets format.
(yas--define-snippets-1): Use it.
(yas--update-template): Return TEMPLATE argument.
2015-09-04 18:33:44 -04:00
João Távora
2f6cfef031 Closes #601: updated snippets submodule 2015-08-11 20:22:26 +01:00
João Távora
4bd3d98b68 Merge pull request #599 from zmwangx/snippet-compilation-doc
Add documentation for snippet compilation
2015-08-05 00:51:40 +01:00
Zhiming Wang
0ada0fc944
Add documentation for snippet compilation
Specifically, fill in the section about .yas-compiled-snippet.el, which
was previously labelled as TODO.

* doc/snippet-organization.org (The =.yas-compiled-snippet.el= file):
  Fill in section.
2015-08-04 14:48:14 -07:00
Noam Postavsky
c91a58840b Simplify some code
* yasnippet.el (yas-define-snippets): Modify the list instead of
  reconstructing it.
  (yas-load-snippet-buffer-and-close): Replace listp and second with
  cdr-safe.  Use string-prefix-p rather than string-match-p.
2015-08-04 14:20:29 -04:00
João Távora
e8934ce816 Merge pull request #596 from npostavs/lookup-snippet
Add yas-lookup-snippet
2015-08-03 19:24:27 +01: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
197db9fc22 Merge pull request #578 from aluaces/patch-1
Fix "invalid function: quote"
2015-05-18 13:12:18 -04:00
Alberto Luaces
4692c8169d Fix "invalid function: quote"
On emacs24, Debian, HTML doc generation finishes with this error.
2015-05-15 23:30:37 +02:00
João Távora
5aebe46e5c Closes #549: Adjust load' verbosity to yas-verbosity'
* yasnippet.el (yas--load-yas-setup-file): Be verbose on `load'
according to `yas-verbosity'
2015-04-15 10:44:52 +01:00
João Távora
7f4f6befc0 Merge pull request #571 from PhilHudson/master
Replaced 'shadow' with 'override' throughout documentation
2015-04-13 22:03:58 +01:00
Phil Hudson
0e7ea945ce Replaced 'shadow' with 'override' throughout documentation
It is hoped that this will add clarity.

* yasnippet.el, doc/snippet-organization.org (documentation):
  Replaced 'shadow' with 'override' globally.
2015-04-13 15:08:24 +01:00
João Távora
23133da7d9 Update README.mdown
* README.mdown (Intro): There hasn't been a downloadable demo
in a long time.
2015-04-05 23:34:01 +01:00
João Távora
890bd7edcd Merge pull request #569 from npostavs/doc-obsolete
README fixes, mark yas-initialize as obsolete
2015-04-05 23:26:37 +01:00
Noam Postavsky
d61910789f yasnippet.el (yas-initialize): Mark obsolete 2015-04-05 18:05:07 -04:00
Noam Postavsky
4fd8ab166b README.mdown (per-buffer): Remove needless lambda 2015-04-05 17:59:18 -04:00
Noam Postavsky
fdef445b7b README.mdown (el-get): Remove obsolete information 2015-04-05 17:57:46 -04:00
João Távora
a46701966a `yas-minor-mode' assertion broke a test. Good. Fix it.
* yasnippet-tests.el
(be-careful-when-escaping-in-yas-selected-text-2): Add
`yas-minor-mode'.
2015-03-23 10:21:26 +00:00
João Távora
885237a485 Add useful development assertion
When debugging snippets after M-x toggle-debug-on-error, errors in the
`post-command-hook' might cause `yas--post-command-handler' to be
removed. That's OK, always check that it's there before attempting any
`yas-expand-snippet' calls, since it is essential to check snippet
movement.

* yasnippet.el (yas-expand-snippet): Assert `yas-minor-mode' and
`yas--post-command-handler' active.
2015-03-23 10:11:19 +00:00
João Távora
316435e03e Closes #562: Deleting inner numberless snippet causes error
* yasnippet.el (yas--field-probably-deleted-p): Protect against
nil `yas--field-number'.

* yasnippet-tests.el (delete-numberless-inner-snippet-issue-562): New test
2015-03-23 10:11:06 +00:00
Stefan Monnier
d19ef74634 Getting rid of low-level assumptions in yasnippet
The main thrust is to get rid of the use of the `cl-struct-slots'
property which doesn't exist in Emacs-25 any more.

* yasnippet.el: Update copyright
(yas--template): Change constructor name from
`yas--make-blank-template' to `yas--make-template'
(yas--populate-template): Remove.
(yas--define-snippets-1): Use `yas--make-template'
(yas--define-snippets-1): Use `setf's
(yas-define-menu, yas--define-menu-1, yas-tryout-snippet): Use
`yas--make-template'
2015-03-20 10:34:33 +00:00
João Távora
fc5052b863 Merge pull request #568 from npostavs/contrib
Add a CONTRIBUTING.md file
2015-03-19 11:30:25 +00:00
Noam Postavsky
b9989f8c8c Add a CONTRIBUTING.md file
Collect some conventions about contributing to Yasnippet (which have
been scattered amongst various issues/pull request) into a single file.

* CONTRIBUTING.md: New File.
2015-03-18 15:59:28 -04:00
Vasilij Schneidermann
3e7b56ebd7 Implements #566: Remove dead major modes code
* yasnippet.el (yas--known-modes, yas--real-mode?): Removed
2015-03-18 11:48:44 +01:00
João Távora
21ffe4b797 Merge pull request #559 from mineo/patch-1
* yasnippet.el (yas-expand-snippet): improve docstring
2015-02-12 10:40:33 +00:00
Wieland Hoffmann
3c133487dc yas-expand-snippet: Clarify EXPAND-ENV 2015-02-12 11:04:31 +01:00
João Távora
197ef7f0b6 Merge pull request #552 from treese/master
Clarify what happens with yas-new-snippet.

Added more detail about how yas-new-snippet behaves, 
particularly how it guesses a directory to save in.

* doc/snippet-development.org (Quickly finding snippets): 
  enhance section.
2015-01-10 15:56:45 +00:00
Win Treese
07734a1713 Clarify what happens with yas-new-snippet.
Added more detail about how yas-new-snippet behaves, particularly how it guesses a directory to save in.
2015-01-10 10:04:18 -05:00
João Távora
b62bdf3fcd Closes #546: backport yas-initialize' and provide yas/initialize'
* yasnippet.el (yas-initialize): Renamed from `yas--initialize'.
(yas--backported-syms): Add `yas-initialize'
2014-12-23 11:03:09 +00:00