]> code.delx.au - gnu-emacs-elpa/commitdiff
Pass start point to yas-key-syntaxes functions
authorNoam Postavsky <npostavs@users.sourceforge.net>
Sun, 10 Aug 2014 16:52:52 +0000 (12:52 -0400)
committerNoam Postavsky <npostavs@users.sourceforge.net>
Sun, 10 Aug 2014 18:05:25 +0000 (14:05 -0400)
* 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.

yasnippet-tests.el
yasnippet.el

index 8a845dc0873e88689aa9676e793baa710b08effc..12ca61528d16a2f68bae322da7b9ee877f20e8ec 100644 (file)
@@ -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))
index e006d52fc3fa6467c50e7858ca9acceaf9b31808..93eceb24a247c93e6154b9e89155028738af7196 100644 (file)
@@ -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."
 \f
 ;;; 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