Skip to content

Commit

Permalink
Avoid a warning from the byte-compiler
Browse files Browse the repository at this point in the history
There are two options available (1) define `js3-mode-error' and its
alias `js3-mode-help' before using them, or (2) quote the function
symbol using `quote' instead of `function' (' instead of #').

We do the latter here.  The result is that the byte-compiler no longer
knows that these function symbols are intended to be used as functions,
so it no longer checks whether these functions are defined, so it no
longer detects that this may not be the case, and does not complain.
That's okay.  The functions are being defined, just after they are being
defined.

Also note that quoting the first symbol in a `defalias' form as a
function is never right.  When `defalias' arguments are being evaluated
the alias (i.e. the function) is not defined yet, that's why we call it.
  • Loading branch information
tarsius committed May 2, 2016
1 parent dda1151 commit dfb0c9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js3-mode.el
Expand Up @@ -7176,7 +7176,7 @@ it is considered declared."
(js3-get-defining-scope scope name))
(js3-set-face pos end 'js3-external-variable-face 'record)
(js3-record-text-property pos end 'help-echo "Undeclared variable")
(js3-record-text-property pos end 'point-entered #'js3-echo-help))))
(js3-record-text-property pos end 'point-entered 'js3-echo-help))))
(setq js3-recorded-identifiers nil)))

(provide 'js3-highlight)
Expand Down Expand Up @@ -11040,7 +11040,7 @@ This ensures that the counts and `next-error' are correct."
(not (current-message)))
(message msg))))

(defalias #'js3-echo-help #'js3-echo-error)
(defalias 'js3-echo-help #'js3-echo-error)

(defun js3-enter-key ()
"Handle user pressing the Enter key."
Expand Down
2 changes: 1 addition & 1 deletion lib/js3-foot.el
Expand Up @@ -339,7 +339,7 @@ This ensures that the counts and `next-error' are correct."
(not (current-message)))
(message msg))))

(defalias #'js3-echo-help #'js3-echo-error)
(defalias 'js3-echo-help #'js3-echo-error)

(defun js3-enter-key ()
"Handle user pressing the Enter key."
Expand Down
2 changes: 1 addition & 1 deletion lib/js3-highlight.el
Expand Up @@ -447,7 +447,7 @@ it is considered declared."
(js3-get-defining-scope scope name))
(js3-set-face pos end 'js3-external-variable-face 'record)
(js3-record-text-property pos end 'help-echo "Undeclared variable")
(js3-record-text-property pos end 'point-entered #'js3-echo-help))))
(js3-record-text-property pos end 'point-entered 'js3-echo-help))))
(setq js3-recorded-identifiers nil)))

(provide 'js3-highlight)
Expand Down

0 comments on commit dfb0c9d

Please sign in to comment.