From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.bugs Subject: Re: Indentation bug in function INDENT-SEXP (from CVS sources) Date: Sat, 03 Feb 2007 06:20:15 -0500 Message-ID: References: <74edf1b42a57241cff49d9b1b3734674@www.avvantamail.com> Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1170501818 16874 80.91.229.12 (3 Feb 2007 11:23:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 3 Feb 2007 11:23:38 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: sand Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 03 12:23:26 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HDIzN-00027J-Hh for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Feb 2007 12:23:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDIzM-0004kY-R3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Feb 2007 06:23:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HDIxN-0003RF-8B for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2007 06:21:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HDIxM-0003Qs-Ia for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2007 06:21:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDIxM-0003Qm-Cg for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2007 06:21:20 -0500 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HDIxM-0007Hp-5I for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2007 06:21:20 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1HDIwJ-0004tD-Rm; Sat, 03 Feb 2007 06:20:15 -0500 In-reply-to: <74edf1b42a57241cff49d9b1b3734674@www.avvantamail.com> (message from sand on Tue, 30 Jan 2007 11:12:32 -0800) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15574 Archived-At: Thanks for fixing this bug. I will install a variant of your fix. This is a cleaned up version, and seems to work. Does it work well for you? *** lisp-mode.el 21 Jan 2007 01:36:10 -0500 1.196 --- lisp-mode.el 03 Feb 2007 06:10:11 -0500 *************** *** 1128,1146 **** (make-list (- next-depth) nil)) last-depth (- last-depth next-depth) next-depth 0))) ! (or outer-loop-done endpos ! (setq outer-loop-done (<= next-depth 0))) ! (if outer-loop-done ! (forward-line 1) (while (> last-depth next-depth) (setq indent-stack (cdr indent-stack) last-depth (1- last-depth))) (while (< last-depth next-depth) (setq indent-stack (cons nil indent-stack) last-depth (1+ last-depth))) ! ;; Now go to the next line and indent it according ;; to what we learned from parsing the previous one. - (forward-line 1) (setq bol (point)) (skip-chars-forward " \t") ;; But not if the line is blank, or just a comment --- 1128,1152 ---- (make-list (- next-depth) nil)) last-depth (- last-depth next-depth) next-depth 0))) ! (forward-line 1) ! ;; Decide whether to exit. ! (if endpos ! ;; If we have already reached the specified end, ! ;; give up and do not reindent this line. ! (if (<= endpos (point)) ! (setq outer-loop-done t)) ! ;; If no specified end, we are done if we have finished one sexp. ! (if (<= next-depth 0) ! (setq outer-loop-done t))) ! (unless outer-loop-done (while (> last-depth next-depth) (setq indent-stack (cdr indent-stack) last-depth (1- last-depth))) (while (< last-depth next-depth) (setq indent-stack (cons nil indent-stack) last-depth (1+ last-depth))) ! ;; Now indent the next line according ;; to what we learned from parsing the previous one. (setq bol (point)) (skip-chars-forward " \t") ;; But not if the line is blank, or just a comment