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 21:53:18 +0200 Message-ID: <87myxyep8x.fsf@ambire.localdomain> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184442822 21110 80.91.229.12 (14 Jul 2007 19:53:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 14 Jul 2007 19:53:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: lenst@lysator.liu.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 14 21:53:40 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 1I9ngS-0001HH-IQ for ged-emacs-devel@m.gmane.org; Sat, 14 Jul 2007 21:53:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I9ngS-0002Jd-8S for ged-emacs-devel@m.gmane.org; Sat, 14 Jul 2007 15:53:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I9ngN-0002Er-RK for emacs-devel@gnu.org; Sat, 14 Jul 2007 15:53:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I9ngM-0002CR-SH for emacs-devel@gnu.org; Sat, 14 Jul 2007 15:53:35 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I9ngM-0002C1-JF for emacs-devel@gnu.org; Sat, 14 Jul 2007 15:53:34 -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 1I9ngM-0004IN-0F for emacs-devel@gnu.org; Sat, 14 Jul 2007 15:53:34 -0400 Original-Received: from localhost (172.31.0.51) by smtp-out3.libero.it (7.3.120) id 4688F31B014B45D8 for emacs-devel@gnu.org; Sat, 14 Jul 2007 21:53:33 +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-out10.libero.it [192.168.32.38]) (amavisd-new, port 10024) with ESMTP id TCi0Z1vmzM8S for ; Sat, 14 Jul 2007 21:53:33 +0200 (CEST) Original-Received: from mailrelay07.libero.it (192.168.32.94) by smtp-out1.libero.it (7.3.120) id 4611FC9107BD03A2 for emacs-devel@gnu.org; Sat, 14 Jul 2007 21:53:33 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAD/GmEaXFSCK/2dsb2JhbACBSg Original-Received: from ppp-138-32.21-151.libero.it (HELO ambire.localdomain) ([151.21.32.138]) by OutRelay-b07.libero.it with ESMTP; 14 Jul 2007 21:53:32 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1I9ng6-0002oY-9m; Sat, 14 Jul 2007 21:53:18 +0200 In-Reply-To: (Richard Stallman's message of "Sat\, 14 Jul 2007 14\:00\:13 -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:74780 Archived-At: () Lennart Staflin () Thu, 31 May 2007 11:44:46 +0200 In lisp-mode the indentation of the following expression is wrong: (foo :bar :a12 :sie sume ) If I press TAB at the beginning of the last line I get: (foo :bar :a12 :sie sume ) I think this is wrong, the indentation should be as the first example. This was not the behaviour in emacs 21, neither is the beaviour of indent-region consistent with TAB. does the following patch give good results? here is a description of the change: * emacs-lisp/lisp-mode.el (calculate-lisp-indent): Use the last sexp that begins a line, instead of the truly last sexp. can someone suggest a better implementation? 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 19:48:07 -0000 *************** *** 854,859 **** --- 854,866 ---- (> (setq paren-depth (elt state 0)) 0)) (setq retry nil) (setq calculate-lisp-indent-last-sexp (elt state 2)) + ;; The last sexp may not be the first sexp on the line + ;; where it begins, so find that one, instead. + (when calculate-lisp-indent-last-sexp + (goto-char calculate-lisp-indent-last-sexp) + (beginning-of-line) + (skip-chars-forward " \t") + (setq calculate-lisp-indent-last-sexp (point))) (setq containing-sexp (elt state 1)) ;; Position following last unclosed open. (goto-char (1+ containing-sexp))