Emacs Per File Customization

I have an Emacs Lisp file with custom macros I want fontified and indented differently. The code looks like:

(defmacro* when-let ((var value) &rest body)
  `(let ((,var ,value))
     (when ,var ,@body)))

(defun func ()
  (when-let (a 1)
    a))

I want when-let fontified as a font-lock-keyword and indented as above. I know I can do this in my .emacs file but I'd prefer to make it a directory local or file local customization. The problem is that directory local and file local customizations seem to be limited to setting variables. In my .emacs file I have the following.

(add-hook 'emacs-lisp-mode-hook
   (lambda ()
             (put 'when-let 'lisp-indent-function 1)
             (font-lock-add-keywords nil
                                     '(("(\\(when-let\\)\\>" 1
                                        font-lock-keyword-face)))))

I want this in .dir-locals.el because it applies only to one file.

5
задан Stefan 7 May 2014 в 12:44
поделиться