From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [jidanni@jidanni.org: shell-script-mode case indenting] Date: Wed, 04 Oct 2006 00:09:25 -0400 Message-ID: References: <87k63wc0pn.fsf@cs.cmu.edu> <87odsvop8k.fsf@cs.cmu.edu> <87bqot19xs.fsf@cs.cmu.edu> <87ac4cvjpe.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 1159934994 23948 80.91.229.2 (4 Oct 2006 04:09:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Oct 2006 04:09:54 +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 06:09:49 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 1GUy4k-0003dO-TO for ged-emacs-devel@m.gmane.org; Wed, 04 Oct 2006 06:09:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GUy4k-0002XD-C0 for ged-emacs-devel@m.gmane.org; Wed, 04 Oct 2006 00:09:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GUy4Z-0002Vy-30 for emacs-devel@gnu.org; Wed, 04 Oct 2006 00:09:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GUy4X-0002Ts-Dm for emacs-devel@gnu.org; Wed, 04 Oct 2006 00:09:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GUy4X-0002Tj-6n for emacs-devel@gnu.org; Wed, 04 Oct 2006 00:09:29 -0400 Original-Received: from [209.226.175.184] (helo=tomts22-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GUyAq-0005R2-Ti; Wed, 04 Oct 2006 00:16:01 -0400 Original-Received: from alfajor.home ([70.53.194.68]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20061004040926.EKYJ10262.tomts22-srv.bellnexxia.net@alfajor.home>; Wed, 4 Oct 2006 00:09:26 -0400 Original-Received: by alfajor.home (Postfix, from userid 20848) id 003DB1C1B7; Wed, 4 Oct 2006 00:09:25 -0400 (EDT) Original-To: Michael Welsh Duggan In-Reply-To: <87ac4cvjpe.fsf@cs.cmu.edu> (Michael Welsh Duggan's message of "Tue\, 03 Oct 2006 23\:33\:17 -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:60407 Archived-At: >>>> 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. Thanks for tracking it down. Stefan