1022 Commits

Author SHA1 Message Date
João Távora
94bd529d08 Fix nesting bug
* snippet-tests.el (nested-skip-fields, navigate-fields-and-exit):
Fix test.
(wrap-selected-region): Use eval trick temporarily.
(snippet--test-fixture): New helper.

* snippet.el (snippet--debug-snippet): More stable sort in
debugging helper.

* snippet.el (with-dynamic-snippet): Fix nesting.
(snippet--call-with-inserting-object): Fix setting the `prev'
slot.
(snippet--call-with-inserting-object): Fix nesting.
2015-04-04 14:13:15 +01:00
João Távora
08784e769f * snippet.el (snippet--debug-snippet): More stable sort 2015-04-04 13:22:21 +01:00
João Távora
d92a479263 Bugfixes
* snippet.el (snippet--post-command-hook): Robustify snippet exit
logic.
(snippet-exit-snippet): Just schedule and exit, but don't exit
directly.
(snippet--activate-snippet): Initialise `snippet--exit-reason' to
nil.
(snippet--activate-snippet): Add to post-command-hook locally.
(snippet--describe-object, snippet--debug-snippet): Fix whitespace
2015-04-04 13:15:59 +01:00
João Távora
91a0b281c7 Improve debugging tool
* snippet.el (define-static-snippet): Fix bug.
(snippet--activate-snippet): Must use `cl-copy-list'
(snippet--describe-object): Changed to generic function.
(snippet--describe-exit, snippet--describe-mirror)
(snippet--describe-field): Part of the generic.
(snippet--debug-snippet): Uses `snippet--describe-object'
2015-04-04 11:50:28 +01:00
João Távora
c3a73a1777 Add a test case for fixing
* snippet-tests.el (snippet--test-snippets-alist): Add a failing
dynamic snippet.
2015-04-04 10:25:46 +01:00
João Távora
7750c03f4b Arrange for same tests to run over dynamic fixtures
* snippet-tests.el (snippet--insert-test-snippet): Removed.
(basic-expansion, basic-clear-field, basic-delete-char-in-field)
(contrived, contrived-2, nested-expansion, nested-skip-fields)
(mirror-of-nested-field, more-nesting, printf-expansion)
(printf-mirrors, printf-mirrors-and-navigation)
(printf-jump-to-second-field-right-away, sprintf-variation)
(constants-and-default-values): Converted to
`snippet--define-expansion-test'
(snippet--get-fixture): New function.
(snippet--define-expansion-test): New helper macro.

* snippet.el: Improve documentation slightly.
(define-static-snippet): Take `properties' instead of
`args'. Re-add debug spec.

* snippet.el (define-static-snippet): forms -> snippet-forms
2015-04-03 22:40:32 +01:00
João Távora
00967aa8c0 Minor documentation tweaks
* snippet.el: Improve documentation slightly.
(define-static-snippet): Take `properties' instead of
`args'. Re-add debug spec.
2015-04-03 20:29:46 +01:00
João Távora
42543cd9e2 Better names for dynamic and static version
* snippet-tests.el (snippet--test-snippets-alist): Add static and
dynamic version of snippet to fixture.
(snippet--insert-test-snippet): Aware of dynamic snippets.
(sprintf-variation): Reintegrated deleted `snippet--test-sprintf-snippet'
(snippet--test-sprintf-snippet): Deleted.
(snippet-tests): Provide it.

* snippet.el: Better documentation.
(with-static-snippet): Renamed from `snippet--define-body'.
(define-dynamic-snippet): Renamed from `define-snippet'.
(with-dynamic-snippet): New macro.
2015-04-03 20:17:32 +01:00
João Távora
ece2e7d1f2 snippet-defmacro is the dynamic approach, make-snippet the static one
* snippet-tests.el (snippet--sprintf): Use `define-snippet'

* snippet.el: Pass copyright to FSF. Some doc change.
(snippet--define-body): Docstring update.
(define-snippet): Renamed from `snippet-defmacro'
2015-04-03 12:57:26 +01:00
João Távora
9f88e596bf First working test for the new macrolet approach
* snippet-tests.el: Use `lexical-binding: t`
(snippet--test-sprintf-snippet): New helper.
(sprintf-variation): Use it.
(macro-test): Removed.
(snippet--sprintf): New macrolet-style snippet for testing.
(sprintf-maybe-2): New test.

* snippet.el (snippet--define-body): Call
`snippet--make-transform-lambda' here.
(snippet--make-and-insert-mirror): Don't require `source' arg.
(snippet--update-mirror): Only insert when transform returns string.
(snippet-defmacro): Redesign.
(&exit): Add indent spec
2015-04-03 12:31:35 +01:00
João Távora
414d2cbc57 Work a little to support nested fields
* snippet.el (snippet-defmacro): Support nested fields, more or
less...
(&field, &mirror): Add edebug and indent specs.
2015-04-02 21:43:28 +01:00
João Távora
ddca1181a0 Use eieio and attempt a snippet-defmacro per Stefan's suggestion
* snippet-tests.el (macro-test): Dummy test for
`snippet-defmacro'.

* snippet.el (eieio): require 'eieio
(snippet--define-body, snippet--make-and-insert-mirror)
(snippet--make-and-insert-exit): Use `make-instance'
(snippet--field-overlay-changed): Use `snippet--object-start'
(snippet--field-skip-p): Use `snippet--object-parent'
(snippet--object, snippet--field, snippet--mirror)
(snippet--exit): Use `defclass'
(snippet-defmacro): New broken macro.
(&mirror, &field): New edebug specs.
2015-04-02 21:07:23 +01:00
João Távora
d1930d2ff2 Merge in branch 'master' into snippet-engine 2015-04-02 17:51:27 +01: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
João Távora
e161fc0a9d Merge pull request #542 from tarsius/nosearch
Add file doc/.nosearch
2014-12-09 12:08:19 +00:00
Jonas Bernoulli
bb6bbad1f7 Add file doc/.nosearch
This keeps `normal-top-level-add-subdirs-to-load-path'
from adding the directory to the `load-path'.
2014-12-08 14:47:20 +01:00
João Távora
50ca8d30de Update README.mdown
Fix misspellings
2014-11-23 12:23:15 +00:00
João Távora
175e0a3a10 Clean up previous change
* yasnippet.el: Update comment.
(yas--protection-violation): Removed.
(yas--on-protection-overlay-modification): Simplified.
(yas--post-command-handler): No longer reference
`yas--protection-violation'
2014-11-17 11:27:30 +00:00
João Távora
596e6b2640 Closes #537: Be lenient to extensions operating on snippet fields
* yasnippet.el (yas--on-protection-overlay-modification): Commit the
snippets being destroyed instead of signalling a protection violation.
2014-11-04 08:27:34 +00:00
João Távora
1c97671c6e Closes #536: Fix navigation to zero-length fields at snippet end
* yasnippet.el (yas--field-probably-deleted-p): A deleted field
was probably modified before, so enforce that condition.
2014-11-02 23:54:04 +00:00
Noam Postavsky
51d4ed14df Update snippets submodule 2014-10-17 10:36:08 -04:00
João Távora
b22961a4a6 Update README.mdown 2014-10-11 22:27:48 +01:00
João Távora
e2b876baef Tweak README.mdown to simplify bug reporting paragraph 2014-10-11 14:57:49 +01:00
João Távora
6053db05ca Closes #527: Unbreak case where yas-fallback-behaviour is a list
* yasnippet.el (yas--fallback): Extract interesting values from
`yas-fallback-behaviour' before rebinding.
2014-10-09 07:16:36 +01:00
João Távora
70151f4f1e Closes #525, closes #526: Prevent some keybinding fallback loops
* yasnippet.el (yas--keybinding-beyond-yasnippet): Add docstring.
(yas--fallback): Also let-bind `yas-minor-mode' to nil when
falling back.
2014-10-07 14:57:23 +01:00
João Távora
6877bc6db3 Merge pull request #524 from npostavs/fallback-loop
Signal an error on recursive yas--fallback calls
2014-10-05 09:24:34 +01:00
Noam Postavsky
e7314516e3 Signal an error on recursive yas--fallback calls
* yasnippet.el (yas--fallback): let-bind yas-fallback-behavior to
  'yas--fallback before actually doing the fallback. Signal an error if
  it's 'yas--fallback (indicating we're in an infinte loop).
2014-10-04 20:52:58 -04:00
João Távora
08b044e559 Merge pull request #519 from syohex/use-cl-macro 2014-09-29 10:40:07 +01:00
Syohei YOSHIDA
783cc3394f Use cl-incf instead of cl
* yasnippet.el (yas--snippet-next-id, yas--real-line-beginning):
Use `cl-incf'.
2014-09-29 10:38:31 +01:00
João Távora
8e9bf3cdb4 Merge pull request #518 from rnkn/master
Compatibility with custom-unlispify-remove-prefixes
2014-09-22 22:02:00 +01:00
Paul Rankin
6f7c91558a Compatibility with custom-unlispify-remove-prefixes 2014-09-21 00:53:29 +10:00
João Távora
41cb5f565f Update snippets submodule 2014-09-11 11:12:19 +01:00
João Távora
cc64ff62bf Merge pull request #514 from tarsius/master
Cosmetic fixes and quiet byte-compiler
0.9.0-beta
2014-09-09 20:50:56 +01:00
Jonas Bernoulli
70de82164c enforce use of spaces for indentation 2014-09-07 14:20:07 +02:00
Jonas Bernoulli
37df653a67 yasnippet-debug.el: quiet byte-compiler 2014-09-07 14:20:07 +02:00
Jonas Bernoulli
241465cea2 move eof footer to the actual eof 2014-09-07 14:20:07 +02:00
João Távora
be2f815c43 Closes #508: Ensure original point when evaluating conditions
* yasnippet.el (yas--templates-for-key-at-point): Call
`yas--fetch', and hence condition system, with point in the
original position.
0.9.0-a
2014-08-21 08:38:46 +01:00
João Távora
5b59b802ac Closes #495: Allow symbols as aliases in `yas-snippet-dirs'
* yasnippet.el (yas-installed-snippets-dir): New parameter. Set at
load time from `load-file-name'.
(yas--load-file-name): Removed.
(yas-snippet-dirs): Update docstring. Default value has symbol
`yas-installed-snippets-dir' as an alias to any bundled snippets.
(yas-snippet-dirs): Redesign for new `yas-snippet-dirs' semantics.
2014-08-20 21:48:41 +01:00
João Távora
1d4618b022 Closes #504: Correctly discover buffers needing snippets immediately
* yasnippet-tests.el (issue-504-tricky-jit): New test.

* yasnippet.el (yas-load-directory): Use a new `impatient-buffers'
local and call `yas--load-pending-juts' in all those at the end.

* yasnippet.el (cl-lib): Don't need `eval-and-compile'.
2014-08-20 21:29:32 +01:00