[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Better indentation for elisp
From: |
Thierry Volpiatto |
Subject: |
Re: Better indentation for elisp |
Date: |
Tue, 19 Feb 2013 07:55:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Sergey Mozgovoy <address@hidden> writes:
> Thierry Volpiatto-2 wrote
>> See:
>>
>> http://article.gmane.org/gmane.emacs.devel/155910/match=lisp+indent+function
>
> Thank you for response and the link.
>
> I guess you're sure that Emacs Lisp indentation is not so bad as to be
> worth the effort of introducing substantial changes. OK, I agree
> that's probably my own censoriousness which bothers me, rather than
> Elisp indentation. :)
>
> However, please do note that aside from *flet*, there were some other
> examples. I guess they don't annoy pretty much anyone except for me,
> too.
>
> Actually, what struck me the most was the indentation of constructs
> like this:
> *
> (let-like-macro (a 10
> b 20
> c 30)
> ... BODY ...)
> *
> Well, this is actually a let-like construct, but bindings are not
> explicitly taken into additional parenthesis. They are "unrolled".
>
> What I would want here is /flat/ indentation, but present Elisp
> indenting algorithm treats the binding list as a normal function call.
>
> Yeah, I agree that the easiest way to handle this would be to just
> give up and live with default indentation, or use some more
> conventional syntactic constructs.
Here my settings, if that help:
(eval-after-load "cl-indent.el"
(let ((l '((flet ((&whole 4 &rest (&whole 1 &lambda &body)) &body))
(cl-flet* . flet)
(labels . flet)
(cl-flet . flet)
(cl-labels . flet)
(cl-macrolet . flet))))
(dolist (el l)
(put (car el) 'common-lisp-indent-function
(if (symbolp (cdr el))
(get (cdr el) 'common-lisp-indent-function)
(car (cdr el)))))))
(dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
(font-lock-add-keywords
mode
'(("(\\<\\(cl-flet[*]?\\|cl-labels\\|cl-macrolet\\)\\>" 1
font-lock-keyword-face)
("(\\<\\(cl-loop\\|cl-dolist\\)\\>" 1 font-lock-keyword-face))))
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
Re: Better indentation for elisp, Didier Verna, 2013/02/21