1304 Commits

Author SHA1 Message Date
Noam Postavsky
71f0142eda Improve test simulatulation of self-insert
* yasnippet-tests.el (yas-mock-insert): Use `ert-simulate-command' to
  simulate n self-insert-commands.
(simple-mirror, mirror-with-transformation):
(primary-field-transformation, nested-placeholders-kill-superfield):
(nested-placeholders-use-subfield):
(mirrors-adjacent-to-fields-with-nested-mirrors):
(deep-nested-mirroring-issue-351, example-for-issue-271):
(string-match-with-subregexp-in-mirror-transformations): Call
`yas-mock-insert' directly instead of with `ert-simulate-command'.
2015-12-13 00:37:36 -05:00
Noam Postavsky
c80fbf2c0b Cleanup yas--on-field-overlay-modification
* yasnippet.el (yas--on-field-overlay-modification): Remove redundant
  `after?' check; use `=' to save marker vs number type checking.
2015-12-13 00:33:25 -05:00
Noam Postavsky
67a45a61de * README.mdown: Add link to textmate-to-yas.el. 2015-12-12 10:59:21 -05:00
JJ Asghar
444c882b64 * README.mdown: update melpa URL.
Copyright-paperwork-exempt: yes

Close #555.
2015-12-12 10:30:18 -05:00
Noam Postavsky
d78181a7f1 Remove yas--inhibit-overlay-hooks macro.
* yasnippet.el (yas--inhibit-overlay-hooks): Remove.
(yas--commit-snippet, yas--make-move-field-protection-overlays):
(yas-expand-snippet, yas--mirror-update-display):
(yas--field-update-display): Replace `yas--inhibit-overlay-hooks' with
its expansion.
2015-12-09 21:04:24 -05:00
Noam Postavsky
3cd64b74b3 yasnippet.el (yas--called-interactively-p): Remove.
It's unused since "fix: more idiomatic elisp..." 29 Aug 2013
(13d87aa3c0b0289ed918bab545d2b423974688a5).
2015-12-09 20:11:31 -05:00
Noam Postavsky
23ee54e10f Use destructive list functions in yas--s-a-p
`mapcar' already create a fresh list so there is no need to preserve it.

* yasnippet.el (yas--snippets-at-point): Use `delq' and `delete-dups'
  instead of `remove' and `remove-duplicates`, respectively.
2015-12-08 19:03:42 -05:00
Noam Postavsky
6c46878882 Fix #587; set `this-command' on fallback.
`this-original-command' is supposed to be for the command that
we're *not* executing because of key remapping, therefore it doesn't
make sense to set it to the command we're about to execute.

* yasnippet.el (yas--fallback): Set `this-command'.
2015-12-08 18:19:02 -05:00
João Távora
2100b89eb8 Closes #632: Use `user-emacs-directory' instead of hardcoded "~/emacs.d"
* yasnippet.el (yas--default-user-snippets-dir): New defconst.
(yas-snippet-dirs, yas--guess-snippet-directories): Use it.
2015-11-26 13:18:16 +00:00
Sharif Nassar
1cf723a408 Ignore trailing spaces in snippet definitions
Probably nobody wants a snippet `key` with a trailing space. It can
be hard to differentiate from a `key` without trailing space. The
default `<TAB>` behavior of yasnippet will never expand these.

* yasnippet.el (yas--parse-template): Ignore trailing spaces in snippet
  definitions.
* yasnippet-tests.el (deftest ignore-trailing-whitespace): New test for
  new behavior.

Copyright-paperwork-exempt: yes
2015-11-08 18:05:09 -05:00
Sharif Nassar
3aa7cb29d4 M-x delete-trailing-whitespace
* yasnippet.el: delete-trailing-whitespace
* yasnippet-tests.el: delete-trailing-whitespace

Copyright-paperwork-exempt: yes (trivial)
2015-11-08 18:04:08 -05:00
Noam Postavsky
beb02e5e9e * CONTRIBUTING.md: Add note about changelog only messages. 2015-11-07 08:54:08 -05:00
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