Closed tarsius closed 3 years ago
This can be called multiple times in a buffer, so the add-hook
call needs to be idempotent. Using an unquoted lambda form may create a different closure each time, depending on the lexical environment. Therefore quoting is needed.
A better fix would be tracking dependent modes to disable via another mechanism, e.g. a buffer-local variable.
Ah, silly me I should have noticed the comment.
How about just suppressing the warnings?
Suppress warning about quoted lambda
As the preceding comment says, "Quoting is important, because we don't want a variable-capturing closure", but we also don't want the warnings to distract us from any warnings that might show up over time, so we suppress these warnings.
Thanks! I didn't know about with-no-warnings
.
(No quoting is needed. You could wrap the lambda in
function
, but that doesn't really do anything, see http://www.gnu.org/software/emacs/manual/html_node/elisp/Anonymous-Functions.html)