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))))) (puthash location (cons color ov) yas-debug-live-indicators)))))
(defun yas-debug-live-marker (marker) (defun yas-debug-live-marker (marker)
(let* ((buffer (current-buffer)) (let* ((color-ov (yas-debug-get-live-indicator marker))
(color-ov (yas-debug-get-live-indicator marker))
(color (car color-ov)) (color (car color-ov))
(ov (cdr color-ov)) (ov (cdr color-ov))
(decorator (overlay-get ov 'before-string)) (decorator (overlay-get ov 'before-string))
@ -100,7 +99,7 @@
(if (markerp marker) (if (markerp marker)
(propertize str (propertize str
'cursor-sensor-functions 'cursor-sensor-functions
`(,(lambda (window _oldpos dir) `(,(lambda (_window _oldpos dir)
(overlay-put (overlay-put
ov 'before-string ov 'before-string
(propertize decorator (propertize decorator
@ -129,7 +128,7 @@
(if (and beg end (not (integerp beg)) (not (integerp end))) (if (and beg end (not (integerp beg)) (not (integerp end)))
(propertize (format "from %d to %d" (+ beg) (+ end)) (propertize (format "from %d to %d" (+ beg) (+ end))
'cursor-sensor-functions 'cursor-sensor-functions
`(,(lambda (window _oldpos dir) `(,(lambda (_window _oldpos dir)
(let ((face (if (eq dir 'entered) (let ((face (if (eq dir 'entered)
'mode-line-highlight color))) 'mode-line-highlight color)))
(overlay-put ov 'before-string (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 overlays in buffer:\n\n" (length (overlays-in (point-min) (point-max))))
(printf "%s live snippets at point:\n\n" (length (yas-active-snippets))) (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" (printf "\nUndo is %s and point-max is %s.\n"
(if (eq buffer-undo-list t) (if (eq buffer-undo-list t)
@ -286,7 +285,7 @@
(dolist (undo-elem first-ten) (dolist (undo-elem first-ten)
(printf "%2s: %s\n" (cl-position undo-elem first-ten) (printf "%2s: %s\n" (cl-position undo-elem first-ten)
(truncate-string-to-width (format "%s" undo-elem) 70))))) (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) (defun yas--debug-format-fom-concise (fom)
(when fom (when fom
@ -308,8 +307,7 @@
(setq yas-verbosity 99) (setq yas-verbosity 99)
(setq yas-triggers-in-field t) (setq yas-triggers-in-field t)
(setq debug-on-error t) (setq debug-on-error t)
(let* ((snippet-file nil) (let* ((snippet-mode 'fundamental-mode)
(snippet-mode 'fundamental-mode)
(snippet-key nil)) (snippet-key nil))
(unless options (unless options
(setq options (cl-loop for opt = (pop command-line-args-left) (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 (defvar yas--minor-mode-menu nil
"Holds the YASnippet menu.") "Holds the YASnippet menu.")
(defvar yas--condition-cache-timestamp nil)
(defun yas--maybe-expand-key-filter (cmd) (defun yas--maybe-expand-key-filter (cmd)
(when (let ((yas--condition-cache-timestamp (current-time))) (when (let ((yas--condition-cache-timestamp (current-time)))
(yas--templates-for-key-at-point)) (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) (defmacro yas-define-condition-cache (func doc &rest body)
"Define a function FUNC with doc DOC and body BODY. "Define a function FUNC with doc DOC and body BODY.
BODY is executed at most once every snippet expansion attempt, to check 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. "Evaluate BODY with bindings from ENV.
ENV is a list of elements with the form (VAR FORM)." ENV is a list of elements with the form (VAR FORM)."
(declare (debug (form body)) (indent 1)) (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) (defun yas--snippet-map-markers (fun snippet)
"Apply FUN to all marker (sub)fields in 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 (when parent-field
(yas--advance-start-maybe mirror (yas--fom-start parent-field)))) (yas--advance-start-maybe mirror (yas--fom-start parent-field))))
;; Update this mirror. ;; 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 ;; Delay indenting until we're done all mirrors. We must do
;; this to avoid losing whitespace between fields that are ;; this to avoid losing whitespace between fields that are
;; still empty (i.e., they will be non-empty after updating). ;; 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) (cl-loop for (beg . end) in (cl-sort indent-regions #'< :key #'car)
do (yas--indent-region beg end snippet))))))) 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)." "Update MIRROR according to FIELD (and mirror transform)."
(let* ((mirror-parent-field (yas--mirror-parent-field mirror)) (let* ((mirror-parent-field (yas--mirror-parent-field mirror))