Fix some compilation warnings

* yasnippet-tests.el (complicated-yas-key-syntaxes): Avoid looking-back.

* yasnippet.el (yas--font-lock-keywords): Escape $, even if first in the
regexp.
(yas--indent): Remove unused var `end'.
(yas--indent-parse-create): Remove unused arg `snippet'.  Update caller.
This commit is contained in:
Stefan Monnier 2016-06-22 08:53:13 -04:00 committed by Noam Postavsky
parent 6b785e185f
commit ee6e7a9602
2 changed files with 11 additions and 12 deletions

View File

@ -484,7 +484,7 @@ TODO: correct this bug!"
(yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK")))) (yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK"))))
(let ((yas-key-syntaxes (let ((yas-key-syntaxes
(cons #'(lambda (_start-point) (cons #'(lambda (_start-point)
(unless (looking-back "-") (unless (eq ?- (char-before))
(backward-char) (backward-char)
'again)) 'again))
yas-key-syntaxes)) yas-key-syntaxes))

View File

@ -896,10 +896,10 @@ Honour `yas-dont-activate-functions', which see."
;; They're "compiled", so extract the source. ;; They're "compiled", so extract the source.
(cadr font-lock-keywords) (cadr font-lock-keywords)
font-lock-keywords)) font-lock-keywords))
'(("$\\([0-9]+\\)" '(("\\$\\([0-9]+\\)"
(0 font-lock-keyword-face) (0 font-lock-keyword-face)
(1 font-lock-string-face t)) (1 font-lock-string-face t))
("${\\([0-9]+\\):?" ("\\${\\([0-9]+\\):?"
(0 font-lock-keyword-face) (0 font-lock-keyword-face)
(1 font-lock-warning-face t)) (1 font-lock-warning-face t))
("\\(\\$(\\)" 1 font-lock-preprocessor-face) ("\\(\\$(\\)" 1 font-lock-preprocessor-face)
@ -3855,7 +3855,7 @@ Meant to be called in a narrowed buffer, does various passes"
(yas--protect-escapes) (yas--protect-escapes)
;; Parse indent markers: `$>'. ;; Parse indent markers: `$>'.
(goto-char parse-start) (goto-char parse-start)
(yas--indent-parse-create snippet) (yas--indent-parse-create)
;; parse fields with {} ;; parse fields with {}
;; ;;
(goto-char parse-start) (goto-char parse-start)
@ -3961,12 +3961,11 @@ The SNIPPET's markers are preserved."
(zerop (current-column))) (zerop (current-column)))
(indent-to-column yas--indent-original-column))) (indent-to-column yas--indent-original-column)))
((eq yas-indent-line 'auto) ((eq yas-indent-line 'auto)
(let ((end (set-marker (make-marker) (point-max))))
(unless yas-also-auto-indent-first-line (unless yas-also-auto-indent-first-line
(forward-line 1)) (forward-line 1))
(yas--indent-region (line-beginning-position) (yas--indent-region (line-beginning-position)
(point-max) (point-max)
snippet)))))) snippet)))))
(defun yas--collect-snippet-markers (snippet) (defun yas--collect-snippet-markers (snippet)
"Make a list of all the markers used by SNIPPET." "Make a list of all the markers used by SNIPPET."
@ -4073,8 +4072,8 @@ with their evaluated value into `yas--backquote-markers-and-strings'."
(set-marker-insertion-type marker nil) (set-marker-insertion-type marker nil)
marker)) marker))
(defun yas--indent-parse-create (snippet) (defun yas--indent-parse-create ()
"Parse the \"$>\" indentation markers in SNIPPET." "Parse the \"$>\" indentation markers just inserted."
(setq yas--indent-markers ()) (setq yas--indent-markers ())
(while (search-forward "$>" nil t) (while (search-forward "$>" nil t)
(delete-region (match-beginning 0) (match-end 0)) (delete-region (match-beginning 0) (match-end 0))