Fix some compilation warnings

* yasnippet-debug.el (yas--condition-cache-timestamp): Move it before first use.
(yas-debug-live-marker, yas-debug-live-range, yas-debug-snippet-vars)
(yas-debug-process-command-line): Remove or mark unused
variable/parameters.
(yas--letenv): Use `cl-progv'.
(yas--mirror-update-display): Remove unused SNIPPET parameter, update
caller.
This commit is contained in:
Stefan Monnier 2017-07-18 00:14:00 -04:00 committed by Noam Postavsky
parent 7365f9ed40
commit 304c01a44a
2 changed files with 13 additions and 12 deletions

View File

@ -91,8 +91,7 @@
(puthash location (cons color ov) yas-debug-live-indicators)))))
(defun yas-debug-live-marker (marker)
(let* ((buffer (current-buffer))
(color-ov (yas-debug-get-live-indicator marker))
(let* ((color-ov (yas-debug-get-live-indicator marker))
(color (car color-ov))
(ov (cdr color-ov))
(decorator (overlay-get ov 'before-string))
@ -100,7 +99,7 @@
(if (markerp marker)
(propertize str
'cursor-sensor-functions
`(,(lambda (window _oldpos dir)
`(,(lambda (_window _oldpos dir)
(overlay-put
ov 'before-string
(propertize decorator
@ -129,7 +128,7 @@
(if (and beg end (not (integerp beg)) (not (integerp end)))
(propertize (format "from %d to %d" (+ beg) (+ end))
'cursor-sensor-functions
`(,(lambda (window _oldpos dir)
`(,(lambda (_window _oldpos dir)
(let ((face (if (eq dir 'entered)
'mode-line-highlight color)))
(overlay-put ov 'before-string
@ -271,7 +270,7 @@
(printf "%s overlays in buffer:\n\n" (length (overlays-in (point-min) (point-max))))
(printf "%s live snippets at point:\n\n" (length (yas-active-snippets)))
(yas-debug-snippets outbuf)
(yas-debug-snippets outbuf) ;;FIXME: reference to free variable outbuf
(printf "\nUndo is %s and point-max is %s.\n"
(if (eq buffer-undo-list t)
@ -286,7 +285,7 @@
(dolist (undo-elem first-ten)
(printf "%2s: %s\n" (cl-position undo-elem first-ten)
(truncate-string-to-width (format "%s" undo-elem) 70)))))
(display-buffer tracebuf)))
(display-buffer tracebuf))) ;;FIXME: reference to free variable tracebuf
(defun yas--debug-format-fom-concise (fom)
(when fom
@ -308,8 +307,7 @@
(setq yas-verbosity 99)
(setq yas-triggers-in-field t)
(setq debug-on-error t)
(let* ((snippet-file nil)
(snippet-mode 'fundamental-mode)
(let* ((snippet-mode 'fundamental-mode)
(snippet-key nil))
(unless options
(setq options (cl-loop for opt = (pop command-line-args-left)

View File

@ -585,6 +585,8 @@ override bindings from other packages (e.g., `company-mode')."
(defvar yas--minor-mode-menu nil
"Holds the YASnippet menu.")
(defvar yas--condition-cache-timestamp nil)
(defun yas--maybe-expand-key-filter (cmd)
(when (let ((yas--condition-cache-timestamp (current-time)))
(yas--templates-for-key-at-point))
@ -2183,7 +2185,6 @@ Just put this function in `hippie-expand-try-functions-list'."
;;;
;;;
;;;
(defvar yas--condition-cache-timestamp nil)
(defmacro yas-define-condition-cache (func doc &rest body)
"Define a function FUNC with doc DOC and body BODY.
BODY is executed at most once every snippet expansion attempt, to check
@ -3030,7 +3031,9 @@ DEPTH is a count of how many nested mirrors can affect this mirror"
"Evaluate BODY with bindings from ENV.
ENV is a list of elements with the form (VAR FORM)."
(declare (debug (form body)) (indent 1))
`(eval (cl-list* 'let* ,env ',body)))
(let ((envvar (make-symbol "env")))
`(let ((,envvar ,env))
(cl-progv (mapcar #'car ,envvar) (mapcar #'cadr ,envvar) . ,body))))
(defun yas--snippet-map-markers (fun snippet)
"Apply FUN to all marker (sub)fields in SNIPPET.
@ -4543,7 +4546,7 @@ When multiple expressions are found, only the last one counts."
(when parent-field
(yas--advance-start-maybe mirror (yas--fom-start parent-field))))
;; Update this mirror.
do (yas--mirror-update-display mirror field snippet)
do (yas--mirror-update-display mirror field)
;; Delay indenting until we're done all mirrors. We must do
;; this to avoid losing whitespace between fields that are
;; still empty (i.e., they will be non-empty after updating).
@ -4560,7 +4563,7 @@ When multiple expressions are found, only the last one counts."
(cl-loop for (beg . end) in (cl-sort indent-regions #'< :key #'car)
do (yas--indent-region beg end snippet)))))))
(defun yas--mirror-update-display (mirror field snippet)
(defun yas--mirror-update-display (mirror field)
"Update MIRROR according to FIELD (and mirror transform)."
(let* ((mirror-parent-field (yas--mirror-parent-field mirror))