Leo sdl.web@gmail.com writes:
Dear all,
I have the following line in my ~/.emacs:
(setq lisp-indent-function 'common-lisp-indent-function)
This causes all lisp files to use common-lisp indent style. However all elisp files out there are using the default indent which will
cause inconvenience when editing. So here is the question,
How could I set up emacs to use default indent for elisp and common-lisp indent for other lisp files?
Here's what I do:
(defun ns:set-lisp-indent (indent-function) (set (make-local-variable 'lisp-indent-function) indent-function))
(defun ns:setup-elisp-mode () (ns:set-lisp-indent 'lisp-indent-function))
(add-hook 'emacs-lisp-mode-hook 'ns:setup-elisp-mode) (add-hook 'lisp-interaction-mode-hook 'ns:setup-elisp-mode)
(defun ns:setup-common-lisp-mode () (ns:set-lisp-indent 'common-lisp-indent-function))
(add-hook 'lisp-mode-hook 'ns:setup-common-lisp-mode) (add-hook 'inferior-lisp-mode-hook 'ns:setup-common-lisp-mode) (add-hook 'slime-repl-mode-hook 'ns:setup-common-lisp-mode)
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs."