mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
Pass start point to yas-key-syntaxes functions
* yasnippet-tests.el (complicated-yas-key-syntaxes): accept argument. * yasnippet.el (yas-try-key-from-whitespace): accept argument. (yas-shortest-key-until-whitespace): accept argument. (yas--templates-for-key-at-point): pass start point the methods. (yas-key-syntaxes): update docstring.
This commit is contained in:
parent
280ece2af4
commit
10ecde158e
@ -337,7 +337,7 @@ TODO: correct this bug!"
|
||||
(let ((yas--foobarbaz t))
|
||||
(yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK"))))
|
||||
(let ((yas-key-syntaxes
|
||||
(cons #'(lambda ()
|
||||
(cons #'(lambda (_start-point)
|
||||
(unless (looking-back "-")
|
||||
(backward-char)
|
||||
'again))
|
||||
|
18
yasnippet.el
18
yasnippet.el
@ -395,15 +395,15 @@ the trigger key itself."
|
||||
Each element in this list specifies how to skip buffer positions
|
||||
backwards and look for the start of a trigger key.
|
||||
|
||||
Each element can be either a string or a functino of no
|
||||
arguments. A string element is simply passed to
|
||||
`skip-syntax-backward' whereas a function element is called with
|
||||
no arguments and should also place point before the original
|
||||
Each element can be either a string or a function receiving the
|
||||
original point as an argument. A string element is simply passed
|
||||
to `skip-syntax-backward' whereas a function element is called
|
||||
with no arguments and should also place point before the original
|
||||
position.
|
||||
|
||||
The string between the resulting buffer position and the original
|
||||
point.in the is matched against the trigger keys in the active
|
||||
snippet tables.
|
||||
point is matched against the trigger keys in the active snippet
|
||||
tables.
|
||||
|
||||
If no expandable snippets are found, the next element is the list
|
||||
is tried, unless a function element returned the symbol `again',
|
||||
@ -1239,7 +1239,7 @@ Returns (TEMPLATES START END). This function respects
|
||||
(skip-syntax-backward method)
|
||||
(setq methods (cdr methods)))
|
||||
((functionp method)
|
||||
(unless (eq (funcall method)
|
||||
(unless (eq (funcall method original)
|
||||
'again)
|
||||
(setq methods (cdr methods))))
|
||||
(t
|
||||
@ -2729,7 +2729,7 @@ and `kill-buffer' instead."
|
||||
|
||||
;;; User convenience functions, for using in `yas-key-syntaxes'
|
||||
|
||||
(defun yas-try-key-from-whitespace ()
|
||||
(defun yas-try-key-from-whitespace (_start-point)
|
||||
"Go back to nearest whitespace.
|
||||
|
||||
A newline will be considered whitespace even if the mode syntax
|
||||
@ -2737,7 +2737,7 @@ marks it as something else (typically comment ender). Use as
|
||||
element of `yas-key-syntaxes'."
|
||||
(skip-chars-backward "^[:space:]\n"))
|
||||
|
||||
(defun yas-shortest-key-until-whitespace ()
|
||||
(defun yas-shortest-key-until-whitespace (_start-point)
|
||||
"Return `again' until at whitespace.
|
||||
|
||||
A newline will be considered whitespace even if the mode syntax
|
||||
|
Loading…
x
Reference in New Issue
Block a user