unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Better indentation for elisp
Date: Tue, 19 Feb 2013 07:55:26 +0100	[thread overview]
Message-ID: <87hal8hjxd.fsf@gmail.com> (raw)
In-Reply-To: 1361255021128-278696.post@n5.nabble.com

Sergey Mozgovoy <egnartsms@gmail.com> 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 




  reply	other threads:[~2013-02-19  6:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18 19:59 Better indentation for elisp Sergey Mozgovoy
2013-02-18 20:45 ` Thierry Volpiatto
2013-02-19  6:23   ` Sergey Mozgovoy
2013-02-19  6:55     ` Thierry Volpiatto [this message]
2013-02-19 13:53 ` Stefan Monnier
2013-02-19 15:41   ` João Távora
2013-02-20 14:55   ` Sergey Mozgovoy
2013-02-20 15:47     ` Stefan Monnier
2013-02-21 10:51       ` Sergey Mozgovoy
2013-02-21 15:31         ` Stefan Monnier
2013-02-21 15:54 ` Didier Verna
2013-02-24  8:29   ` Sergey Mozgovoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hal8hjxd.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).