From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: bojohan+news@dd.chalmers.se (Johan =?utf-8?Q?Bockg=C3=A5rd?=) Newsgroups: gmane.emacs.devel Subject: Re: Indentation of constants in LISP Date: Tue, 20 Feb 2007 14:29:06 +0100 Message-ID: References: <23847250.4061170433063829.JavaMail.www@wwinf4103> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1171978205 19276 80.91.229.12 (20 Feb 2007 13:30:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 20 Feb 2007 13:30:05 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 20 14:29:59 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HJV4A-00029l-IS for ged-emacs-devel@m.gmane.org; Tue, 20 Feb 2007 14:29:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HJV4A-0007St-2U for ged-emacs-devel@m.gmane.org; Tue, 20 Feb 2007 08:29:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HJV3d-0007HA-T0 for emacs-devel@gnu.org; Tue, 20 Feb 2007 08:29:25 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HJV3c-0007G8-0c for emacs-devel@gnu.org; Tue, 20 Feb 2007 08:29:24 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HJV3b-0007Fz-Lt for emacs-devel@gnu.org; Tue, 20 Feb 2007 08:29:23 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HJV3a-0005nd-Qs for emacs-devel@gnu.org; Tue, 20 Feb 2007 08:29:23 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HJV3X-0007Rn-Ld for emacs-devel@gnu.org; Tue, 20 Feb 2007 14:29:19 +0100 Original-Received: from gamma02.me.chalmers.se ([129.16.50.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Feb 2007 14:29:19 +0100 Original-Received: from bojohan+news by gamma02.me.chalmers.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Feb 2007 14:29:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 84 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: gamma02.me.chalmers.se Mail-Copies-To: never User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux) Cancel-Lock: sha1:ZTgp3IrFwOqQWEbb+MjiESA1G4s= X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:66549 Archived-At: A Soare 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