From: bojohan+news@dd.chalmers.se (Johan Bockgård)
To: emacs-devel@gnu.org
Subject: Re: Indentation of constants in LISP
Date: Tue, 20 Feb 2007 14:29:06 +0100 [thread overview]
Message-ID: <yoij649x7yal.fsf@gamma02.me.chalmers.se> (raw)
In-Reply-To: 23847250.4061170433063829.JavaMail.www@wwinf4103
A Soare <alinsoar@voila.fr> writes:
> In case that the first symbol of the current line is a constant,
> the indentation will be:
>
> '( :stipple nil
> :background "LightBlue"
> :foreground "Black"
> :inverse-video nil
See below.
> (f p q r :name nil
> :server nil
It's not clear that this is necessarily an improvement.
Generally, I think that this approach is flawed. It breaks the
indentation of many forms, and trying to "align" things in this way is
a bad idea in the first place.
Problems:
(prog2
x
:y
z)
(defcustom var :val
:group foo)
(foo :a b :c d
:e f)
(foo a :b c
d
:e f)
(actually, TAB and indent-region produce different results in the
last two cases!)
etc.
Here's one more:
:x TAB => error
OTOH, this one-line patch by Pascal Bourguignon might be a good idea:
http://common-lisp.net/pipermail/slime-devel/2004-October/002487.html
--- lisp-mode.el 18 Feb 2007 00:06:37 +0100 1.199
+++ lisp-mode.el 20 Feb 2007 13:35:31 +0100
@@ -965,7 +965,7 @@
(goto-char (1+ (elt state 1)))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
(if (and (elt state 2)
- (not (looking-at "\\sw\\|\\s_")))
+ (or (looking-at ":") (not (looking-at "\\sw\\|\\s_"))))
;; car of form doesn't seem to be a symbol
(progn
(if (not (> (save-excursion (forward-line 1) (point))
It indents
(:stipple y
z)
to go along with the existing treatment of forms that begin with a
constant, such as
("stipple" y
z)
(Technically, ":foo" isn't disallowed as a function name, but it is
highly unusual.)
--
Johan Bockgård
next prev parent reply other threads:[~2007-02-20 13:29 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-02 16:17 Indentation of constants in LISP A Soare
2007-02-03 11:19 ` Richard Stallman
2007-02-20 13:29 ` Johan Bockgård [this message]
2007-02-21 0:44 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2007-02-04 11:37 A Soare
2007-02-04 13:28 A Soare
2007-02-05 0:23 ` Richard Stallman
2007-02-05 1:28 ` Stefan Monnier
2007-02-05 7:41 A Soare
2007-02-05 19:06 ` Stefan Monnier
2007-02-05 9:51 A Soare
2007-02-05 14:33 A Soare
2007-02-20 14:14 A Soare
2007-02-20 18:04 ` Stuart D. Herring
2007-02-20 14:26 A Soare
2007-02-21 22:55 ` Richard Stallman
2007-02-20 15:28 A Soare
2007-02-20 18:23 A Soare
2007-02-20 19:17 A Soare
2007-02-21 8:38 ` Richard Stallman
2007-02-21 8:32 A Soare
2007-02-21 10:41 A Soare
2007-02-22 17:21 ` Richard Stallman
2007-02-21 22:33 A Soare
2007-02-22 2:24 A Soare
2007-02-22 17:20 ` Richard Stallman
2007-02-22 2:53 A Soare
2007-02-22 13:29 A Soare
2007-02-23 15:58 A Soare
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yoij649x7yal.fsf@gamma02.me.chalmers.se \
--to=bojohan+news@dd.chalmers.se \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.