yasuyk / web-beautify

Format HTML, CSS and JavaScript/JSON by js-beautify
GNU General Public License v3.0
219 stars 21 forks source link

Hooks for formatting before saving #10

Closed xiongtx closed 8 years ago

xiongtx commented 10 years ago

When I use the following in my init.el

(eval-after-load 'css-mode
  '(add-hook 'css-mode-hook
             (lambda ()
               (add-hook 'before-save-hook 'web-beautify-css-buffer t t))))

I get a compiler error when I compile my init file.

When I remove the eval-after-load part, as follows

(add-hook 'css-mode-hook
      (lambda ()
        (add-hook 'before-save-hook 'web-beautify-css-buffer t t)))

The compiler error goes away. The effect seems to the same. Any idea what might be wrong? I think the issue is probably due to something about Emacs Lisp that I don't understand.

I'm using Emacs version 24.4.50.1.

xiongtx commented 8 years ago

Closing (a bit late!) since I've changed my Emacs configuration significantly.