The function js2-highlight-unused-variables
is a function used by js2-highlight-unused-variables-mode
, which is a minor mode: https://github.com/mooz/js2-mode/blob/master/js2-mode.el
In general, minor modes are turned on as follows:
(js2-highlight-unused-variables-mode 1)
And, they are turned off as follows:
(js2-highlight-unused-variables-mode -1)
The original poster has created a function that looks like this:
(defun turn-on-highlight-unused-vars-on-js2-mode()(js2-highlight-unused-variables))
Instead, the original poster could try the following:
(defun turn-on-highlight-unused-vars-on-js2-mode ()
(js2-highlight-unused-variables-mode 1))
With respect to web-beautify
, the original poster will need to carefully compare his/her own code to the instructions on the homepage for the github repository -- https://github.com/yasuyk/web-beautify. If those instructions do not appear to work, then the original poster may wish to reduce his/her .emacs
file to the absolute minimal installation needed for web-beautify
and see if it works as expected. If web-beautify
works as expected with a minimal .emacs
installation, then the original poster can start enabling the other settings little by little until the culprit is located.
The instructions state in relevant part:
If you want to automatically format before saving a file, add the following hook to your emacs configuration:
(eval-after-load 'js2-mode
'(add-hook 'js2-mode-hook
(lambda ()
(add-hook 'before-save-hook 'web-beautify-js-buffer t t))))
;; Or if you're using 'js-mode' (a.k.a 'javascript-mode')
(eval-after-load 'js
'(add-hook 'js-mode-hook
(lambda ()
(add-hook 'before-save-hook 'web-beautify-js-buffer t t))))
(eval-after-load 'json-mode
'(add-hook 'json-mode-hook
(lambda ()
(add-hook 'before-save-hook 'web-beautify-js-buffer t t))))
(eval-after-load 'sgml-mode
'(add-hook 'html-mode-hook
(lambda ()
(add-hook 'before-save-hook 'web-beautify-html-buffer t t))))
(eval-after-load 'css-mode
'(add-hook 'css-mode-hook
(lambda ()
(add-hook 'before-save-hook 'web-beautify-css-buffer t t))))
*Messages*
buffer by using(message "this and this stage reached")
for example. Similarly, you could log hook execution by placing message calls in relevant functions.desktop-save-mode
? If so, it's very unlikely, but you can try to figure it out by either starting Emacs with--no-desktop
option or by removing everything that was saved in the desktop file by callingM-x desktop-clear
and restarting Emacs.