From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Welsh Duggan Newsgroups: gmane.emacs.devel Subject: Re: [jidanni@jidanni.org: shell-script-mode case indenting] Date: Tue, 03 Oct 2006 23:33:17 -0400 Message-ID: <87ac4cvjpe.fsf@cs.cmu.edu> References: <87k63wc0pn.fsf@cs.cmu.edu> <87odsvop8k.fsf@cs.cmu.edu> <87bqot19xs.fsf@cs.cmu.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1159932843 18722 80.91.229.2 (4 Oct 2006 03:34:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Oct 2006 03:34:03 +0000 (UTC) Cc: Glenn Morris , emacs-devel@gnu.org, rms@gnu.org, jidanni@jidanni.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 04 05:33:59 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GUxVz-0004NA-GR for ged-emacs-devel@m.gmane.org; Wed, 04 Oct 2006 05:33:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GUxVy-000329-O9 for ged-emacs-devel@m.gmane.org; Tue, 03 Oct 2006 23:33:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GUxVm-00031N-PR for emacs-devel@gnu.org; Tue, 03 Oct 2006 23:33:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GUxVl-0002zz-HA for emacs-devel@gnu.org; Tue, 03 Oct 2006 23:33:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GUxVl-0002zo-BS for emacs-devel@gnu.org; Tue, 03 Oct 2006 23:33:33 -0400 Original-Received: from [205.201.10.244] (helo=maru) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GUxc5-0002v5-64; Tue, 03 Oct 2006 23:40:05 -0400 Original-Received: from md5i by maru with local (Exim 4.63) (envelope-from ) id 1GUxVW-0007qe-37; Tue, 03 Oct 2006 23:33:18 -0400 Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Tue\, 03 Oct 2006 15\:41\:29 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:60406 Archived-At: Stefan Monnier writes: >>> In your new code, what is the purpose of the following line in the loop: >>> (unless (eobp) (forward-char 1)) >> Don't move forward by a character if at the end of a (narrowed) >> buffer. > > Well, that's the result, not the purpose :-( > >> The need to move forward a character was experimentally >> determined, I am afraid. > > That's the part I'm interested in. Could you give us some idea of the case(s) > you've encountered where it was found necessary? It actually took me a long time to figure out why. (I was at work when I answered you originally, and as such couldn't verify why at the time.) Before you restructured `sh-prev-thing' to not use narrowing, the (unless (bolp) (forward-char -1))) on line 2263-4 (in `sh-get-indent-info') would place the cursor before the last character of the previous token. When narrowed by the next call to `sh-prev-thing', the narrowing cut off that character, causing `sh-get-word' to fail to get the next word. Your change which removes narrowing in favor of explicit match limits is a much more elegant solution, and obviates the need for the questionable line. -- Michael Welsh Duggan (md5i@cs.cmu.edu)