From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: Bug in lisp indentation Date: Sat, 14 Jul 2007 22:46:39 +0200 Message-ID: <87abtyems0.fsf@ambire.localdomain> References: <87myxyep8x.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184446025 29376 80.91.229.12 (14 Jul 2007 20:47:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 14 Jul 2007 20:47:05 +0000 (UTC) Cc: lenst@lysator.liu.se, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 14 22:47:03 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 1I9oW5-0005JA-Op for ged-emacs-devel@m.gmane.org; Sat, 14 Jul 2007 22:47:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I9oW4-0007Bp-W6 for ged-emacs-devel@m.gmane.org; Sat, 14 Jul 2007 16:47:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I9oW1-0007Ba-So for emacs-devel@gnu.org; Sat, 14 Jul 2007 16:46:57 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I9oW0-0007BO-Ff for emacs-devel@gnu.org; Sat, 14 Jul 2007 16:46:56 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I9oW0-0007BL-9s for emacs-devel@gnu.org; Sat, 14 Jul 2007 16:46:56 -0400 Original-Received: from smtp-out3.libero.it ([212.52.84.43]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I9oVz-0005Et-PL for emacs-devel@gnu.org; Sat, 14 Jul 2007 16:46:56 -0400 Original-Received: from localhost (172.31.0.52) by smtp-out3.libero.it (7.3.120) id 4688F31B014B80E0 for emacs-devel@gnu.org; Sat, 14 Jul 2007 22:46:54 +0200 X-Scanned: with antispam and antivirus automated system at libero.it Original-Received: from smtp-out1.libero.it ([172.31.0.37]) by localhost (asav-out11.libero.it [192.168.32.39]) (amavisd-new, port 10024) with ESMTP id TAZOnOlZHt8I for ; Sat, 14 Jul 2007 22:46:54 +0200 (CEST) Original-Received: from MailRelay10.libero.it (192.168.32.119) by smtp-out1.libero.it (7.3.120) id 4611FC9107BD48F0 for emacs-devel@gnu.org; Sat, 14 Jul 2007 22:46:54 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAJrTmEaXFSCK/2dsb2JhbACBSg Original-Received: from ppp-138-32.21-151.libero.it (HELO ambire.localdomain) ([151.21.32.138]) by outrelay-b10.libero.it with ESMTP; 14 Jul 2007 22:46:54 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1I9oVj-0002pT-MW; Sat, 14 Jul 2007 22:46:39 +0200 In-Reply-To: (Stefan Monnier's message of "Sat\, 14 Jul 2007 16\:04\:18 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) X-detected-kernel: Linux 2.4-2.6 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:74783 Archived-At: () Stefan Monnier () Sat, 14 Jul 2007 16:04:18 -0400 That's wrong when you have things like (sdfgsdg dfgsd asfgasfg) (dfg) sfgsfg You want something along the lines of (while (not (at-indentation-p)) (forward-sexp -1)) indeed. i've reworked the adjustment to be more specific. below is try #3. it does not address the case above, however it does not change the current behavior for it, either. * emacs-lisp/lisp-mode.el (calculate-lisp-indent): In the case of constant symbol alignment, consider the sexp actually at indentation to be the "last sexp". thi ______________________________________________________ diff -c -r1.202 lisp-mode.el *** lisp-mode.el 6 Jul 2007 17:26:29 -0000 1.202 --- lisp-mode.el 14 Jul 2007 20:38:40 -0000 *************** *** 930,935 **** --- 930,945 ---- (goto-char indent-point) (skip-chars-forward " \t") (looking-at ":")) + ;; The last sexp may not be the first sexp on the line + ;; where it begins, so find that one, instead. + (save-excursion + (goto-char calculate-lisp-indent-last-sexp) + (while (and (not (looking-back "^[ \t]*")) + (or (not containing-sexp) + (< (1+ containing-sexp) (point)))) + (forward-sexp -1) + (backward-prefix-chars)) + (setq calculate-lisp-indent-last-sexp (point))) (> calculate-lisp-indent-last-sexp (save-excursion (goto-char (1+ containing-sexp))