mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
Minor documentation tweaks
* snippet.el: Improve documentation slightly. (define-static-snippet): Take `properties' instead of `args'. Re-add debug spec.
This commit is contained in:
parent
42543cd9e2
commit
00967aa8c0
19
snippet.el
19
snippet.el
@ -34,6 +34,11 @@
|
|||||||
;; textmate's). There are also `with-dynamic-snippet' and `with-static-snippet'
|
;; textmate's). There are also `with-dynamic-snippet' and `with-static-snippet'
|
||||||
;; macros to use in your own defuns.
|
;; macros to use in your own defuns.
|
||||||
;;
|
;;
|
||||||
|
;; The snippet definitions defined with both macros `define-*-snippet' macros
|
||||||
|
;; can be `edebug'ed and stepped through on snippet insertion and
|
||||||
|
;; navigation. (TODO: for `define-dynamic-snippet', this works for forms in
|
||||||
|
;; snippet fields, but fails for mirrors for some reason.)
|
||||||
|
;;
|
||||||
;; Once inserted into a buffer, snippets are navigated using
|
;; Once inserted into a buffer, snippets are navigated using
|
||||||
;; `snippet-next-field' and `snippet-prev-field', bound to TAB and S-TAB by
|
;; `snippet-next-field' and `snippet-prev-field', bound to TAB and S-TAB by
|
||||||
;; default.
|
;; default.
|
||||||
@ -50,10 +55,6 @@
|
|||||||
;; set of properties controlling snippet's indentation, custom keymapping and
|
;; set of properties controlling snippet's indentation, custom keymapping and
|
||||||
;; other per-snippet characteristics affecting snippet.el's core functionality.
|
;; other per-snippet characteristics affecting snippet.el's core functionality.
|
||||||
;;
|
;;
|
||||||
;; TODO: `define-snippet' should be `edebug'ed and stepped through on snippet
|
|
||||||
;; insertion *and* navigation. This works for forms in snippet fields, but fails
|
|
||||||
;; for mirrors for some reason.
|
|
||||||
;;
|
|
||||||
;; TODO: undo, specifically snippet revival
|
;; TODO: undo, specifically snippet revival
|
||||||
;;
|
;;
|
||||||
;; TODO: more documentation
|
;; TODO: more documentation
|
||||||
@ -236,7 +237,7 @@ As `define-static-snippet' but doesn't define a function."
|
|||||||
("&field" sexp &or ("&nested" &rest snippet-form) def-form)
|
("&field" sexp &or ("&nested" &rest snippet-form) def-form)
|
||||||
def-form))
|
def-form))
|
||||||
|
|
||||||
(defmacro define-static-snippet (name args &optional docstring &rest forms)
|
(defmacro define-static-snippet (name _properties &optional docstring &rest forms)
|
||||||
"Make a snippet-inserting function from FORMS.
|
"Make a snippet-inserting function from FORMS.
|
||||||
|
|
||||||
Each form in SNIPPET-FORMS, inserted at point in order, can be:
|
Each form in SNIPPET-FORMS, inserted at point in order, can be:
|
||||||
@ -261,8 +262,8 @@ Each form in SNIPPET-FORMS, inserted at point in order, can be:
|
|||||||
while the snippet is alive.
|
while the snippet is alive.
|
||||||
|
|
||||||
* A cons (&mirror FIELD-NAME MIRROR-TRANSFORM) defining a mirror
|
* A cons (&mirror FIELD-NAME MIRROR-TRANSFORM) defining a mirror
|
||||||
of the field named FIELD-NAME. MIRROR-TRANSFORM is optional and
|
of the field named FIELD-NAME. MIRROR-TRANSFORM is an optional
|
||||||
is called after each command while the snippet is alive to
|
form, called after each command while the snippet is alive to
|
||||||
produce a string that becomes the mirror text.
|
produce a string that becomes the mirror text.
|
||||||
|
|
||||||
* A string literal or a lisp form CONSTANT evaluated at
|
* A string literal or a lisp form CONSTANT evaluated at
|
||||||
@ -294,12 +295,12 @@ considered to have returned a single whitespace.
|
|||||||
|
|
||||||
PROPERTIES is an even-numbered property list of (KEY VAL)
|
PROPERTIES is an even-numbered property list of (KEY VAL)
|
||||||
pairs. Its meaning is not decided yet"
|
pairs. Its meaning is not decided yet"
|
||||||
(declare ;; (debug (&define name sexp def-body))
|
(declare (debug (&define name sexp &rest snippet-form))
|
||||||
(indent defun))
|
(indent defun))
|
||||||
(unless (stringp docstring)
|
(unless (stringp docstring)
|
||||||
(push docstring forms)
|
(push docstring forms)
|
||||||
(setq docstring nil))
|
(setq docstring nil))
|
||||||
`(defun ,name ,args ,docstring
|
`(defun ,name () ,docstring
|
||||||
(with-static-snippet ,@forms)))
|
(with-static-snippet ,@forms)))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user