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
Joao Tavora
4732c6993b
doc: add commentary section, ran checkdoc
2013-11-07 09:11:41 +00: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
ff48006f55
fix: sort by nesting depth before initial mirror update
...
this is still incomplete, but should be enough for most cases
2013-11-07 00:46:08 +00:00
Joao Tavora
660b90a746
refactor: reorganize code around to shoosh compiler
2013-11-06 14:36:24 +00:00
Joao Tavora
f1a40e5b57
refactor: less macroexpanded code, simplify marker management
2013-11-06 14:27:06 +00:00
Joao Tavora
539c143d49
wip: even closer
2013-11-06 11:15:51 +00:00
Joao Tavora
891c76fa71
wip: in the green!
2013-11-06 10:02:59 +00:00
Joao Tavora
98946135a9
wip: just one test failing
2013-11-06 08:45:01 +00:00
Joao Tavora
dc12a8b4a2
wip: some tests already passing, but lambda scheme sucks
2013-11-06 01:05:39 +00:00
Joao Tavora
c5f62d81ae
wip: still broken, but closer
2013-11-06 00:13:29 +00:00
Joao Tavora
7b7d2cea53
wip: on-going refactor, broken
2013-11-05 19:55:08 +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
782c57985b
fix: don't need this function anymore
2013-11-02 13:25:43 +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
386e84fdde
fix: make-snippet can be a function
2013-10-20 12:40:23 +01:00
Joao Tavora
0daac695e2
add: clear unmodified fields when inserting text at the beginning
2013-10-20 12:28:03 +01:00
Joao Tavora
2db4102fda
fixup: guess I need to close snippet-objects after all
2013-10-19 17:20:25 +01:00
Joao Tavora
76bc40fd03
fix: properly handle snippet and mirror markers with `snippet--open-object'
...
* also snippet--close-object is apparently not needed
* don't call the mirror transforms when field-text is null, just
return empty string. also zero-length fields considered to have a
null field-text, not the empty string.
* correctly place markers when inserting objects
2013-10-19 15:31:24 +01:00
Joao Tavora
d43f42186d
refactor: store prev' and
next' in all objects, not prev-field' and
next-field'
2013-10-19 01:40:44 +01:00
Joao Tavora
67ddacd916
refactor: snippet--[open|close]-markers take objects not markers
2013-10-19 01:17:27 +01:00
Joao Tavora
62c40c50b9
fix: better take a list rather than &rest args in make-snippet
2013-10-19 00:56:35 +01:00
Joao Tavora
b682f6bcac
refactor: snippet--object struct included in fields and mirrors
2013-10-19 00:46:56 +01:00
Joao Tavora
4149acbaae
fix: prefix cl-lib functions with cl and wrap long lines
2013-10-19 00:27:17 +01:00
Joao Tavora
ccf3579344
fix: require cl-lib instead of cl
2013-10-18 14:40:37 +01:00
Joao Tavora
c5276642b8
refactor: do away with snippet--form-[mirror/field]-p, use pcase and cleaner loops
2013-10-18 14:40:01 +01:00
Joao Tavora
55eaf62fd3
fix: order of edebug subforms in &or matters
2013-10-17 13:14:53 +01:00
Joao Tavora
b4bf8bbd33
new: make-snippet makes an anonymous snippet lambda
...
bug: apparently broke edebug though
2013-10-17 12:16:54 +01:00
Joao Tavora
6039bc667f
fix: provide a simple edebug spec for define-snippet
2013-10-16 19:05:04 +01:00
Joao Tavora
26065ae4f5
fix: don't require lexical-binding to call transforms with field text
2013-10-16 19:05:03 +01:00
Joao Tavora
33c696516a
fix: correctly allow functions as snippet forms
...
also make define-snippet expand directly to a defun
2013-10-16 19:05:02 +01:00
Joao Tavora
123f204d20
fix: slightly terser loop syntax
2013-10-16 19:05:01 +01:00
Joao Tavora
d2717d47fd
fix: set local variables correctly, i.e. dont set lexical-binding here
2013-10-16 19:04:59 +01:00
Joao Tavora
e00c7e2661
fix: respect 80 column rule mostly
2013-10-16 19:04:58 +01:00
Joao Tavora
3446300c1f
new: tests go in separate file, minor cleanup in snippet.el
2013-10-14 15:49:34 +01:00
Joao Tavora
2d0a1b831d
fix: possibly fragile fix for zero-length field/mirror bug
2013-10-14 15:12:06 +01:00
Joao Tavora
1f1edb6d4e
wip: fix the overlay-moving bug, but zero-length mirrors/fields still a problem
2013-10-14 15:09:20 +01:00
Joao Tavora
002d524a32
wip: still buggy, but inching closer
2013-10-14 14:54:08 +01:00
Joao Tavora
0919fa6575
fix: oops, big bug, mirrors and fields have to be made then initialized
2013-10-14 01:58:53 +01:00
Joao Tavora
21986d92fd
fix: need to intern marker symbols somewhere, otherwise they won't match
2013-10-13 22:27:25 +01:00
Joao Tavora
5d93e83375
add: insertion works nicely and seems i have simplified the marker mechanism
2013-10-13 21:52:35 +01:00
Joao Tavora
fc1c3632b6
wip: still inoperative, but much better macros, support parent fields
2013-10-12 15:47:43 +01:00
Joao Tavora
f00509a696
wip: a distilled snippet engine
2013-10-12 00:17:37 +01:00