20 Commits

Author SHA1 Message Date
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
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
Joao Tavora
ef1747d947 fix: must sometimes chain object to the end of parent of previous object 2013-11-07 00:49:52 +00:00
Joao Tavora
fc8804471a wip: fix a trivial test 2013-11-06 01:07:55 +00:00
Joao Tavora
d04d5dbae6 add: field ordering and snippet exits 2013-11-04 01:00:03 +00:00
Joao Tavora
b789c13f75 doc: update doc and clarify interface 2013-11-02 14:42:41 +00:00
Joao Tavora
4ece494427 fix: better logic for wrapping selected text and writing mirror transforms 2013-11-02 01:00:03 +00:00
Joao Tavora
f32e4fe2ea fix: better input validation 2013-11-02 00:59:31 +00:00
Joao Tavora
db38009ee8 add: support expansion-time evaluation forms and validate some input 2013-10-31 01:35:19 +00:00
Joao Tavora
f76b876c53 refactor: use new 2013-10-30 16:28:46 +01:00
Joao Tavora
478211060c add: nested fields and nested field skipping 2013-10-20 13:41:32 +01:00
Joao Tavora
5a067b8d3a add: tests for clearing unmodified fields 2013-10-20 12:45:23 +01:00
Joao Tavora
fe4b622a5e add: some contrived tests for marker handling in adjancent fields 2013-10-20 12:43:21 +01:00
Joao Tavora
90528b1664 fix: no need for eval here, since make-snippet is a function 2013-10-20 12:42:19 +01:00
Joao Tavora
54e93b60e9 add: broader tests, already catch many expansion errors 2013-10-19 17:20:51 +01:00
Joao Tavora
9927e08d89 add: another little test 2013-10-17 18:50:59 +01:00
Joao Tavora
0adcad2190 add: ert-based test-suite 2013-10-17 12:17:11 +01:00
Joao Tavora
3446300c1f new: tests go in separate file, minor cleanup in snippet.el 2013-10-14 15:49:34 +01:00