From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Staflin Newsgroups: gmane.emacs.devel Subject: Re: Bug in lisp indentation Date: Sun, 15 Jul 2007 16:43:22 +0200 Message-ID: <469A328A.5060203@lysator.liu.se> References: <87myxyep8x.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1184512389 15920 80.91.229.12 (15 Jul 2007 15:13:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Jul 2007 15:13:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thien-Thi Nguyen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 15 17:13:08 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 1IA5mV-0005wB-L0 for ged-emacs-devel@m.gmane.org; Sun, 15 Jul 2007 17:13:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IA5mU-0000bm-Si for ged-emacs-devel@m.gmane.org; Sun, 15 Jul 2007 11:13:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IA5mR-0000a0-Oz for emacs-devel@gnu.org; Sun, 15 Jul 2007 11:13:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IA5mO-0000Xm-D1 for emacs-devel@gnu.org; Sun, 15 Jul 2007 11:13:03 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IA5mO-0000Xj-AL for emacs-devel@gnu.org; Sun, 15 Jul 2007 11:13:00 -0400 Original-Received: from mail.lysator.liu.se ([130.236.254.3]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IA5mN-0001J5-RD for emacs-devel@gnu.org; Sun, 15 Jul 2007 11:13:00 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 37D0F200A202; Sun, 15 Jul 2007 16:43:34 +0200 (CEST) Original-Received: from mail.lysator.liu.se ([127.0.0.1]) by localhost (lenin.lysator.liu.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19165-01-64; Sun, 15 Jul 2007 16:43:33 +0200 (CEST) Original-Received: from sin.local (host-217-213-135-192.mobileonline.telia.com [217.213.135.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTP id 79358200A208; Sun, 15 Jul 2007 16:43:31 +0200 (CEST) User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) In-Reply-To: <87myxyep8x.fsf@ambire.localdomain> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at lysator.liu.se 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:74816 Archived-At: Thien-Thi Nguyen wrote: > () 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)) > This might align the :sie line with the :bar line, but it introduces other indentation bugs. Also the whitespace in the mail is mangled slightly. The :bar line should not be indented under the left paren, but under the foo symbol. As for a simpler change, I think there is a chunk of code that was added during the pretest to align keyword symbols, that I think is misguided. Removing that code fixes this bug. //Lennart Staflin