From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: skeleton.el machinery eats newlines. Date: Sat, 11 Jan 2003 18:34:49 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200301120034.SAA28513@eel.dms.auburn.edu> References: <200301080429.WAA23098@eel.dms.auburn.edu> <200301100436.WAA27007@eel.dms.auburn.edu> <200301112349.RAA28490@eel.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1042331628 24054 80.91.224.249 (12 Jan 2003 00:33:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 12 Jan 2003 00:33:48 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18XW4Q-0006Fi-00 for ; Sun, 12 Jan 2003 01:33:46 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18XWBA-0002R6-00 for ; Sun, 12 Jan 2003 01:40:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18XW5P-0002fb-02 for emacs-devel@quimby.gnus.org; Sat, 11 Jan 2003 19:34:47 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18XW4z-0002ZN-00 for emacs-devel@gnu.org; Sat, 11 Jan 2003 19:34:21 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18XW4x-0002V5-00 for emacs-devel@gnu.org; Sat, 11 Jan 2003 19:34:19 -0500 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18XW4w-0002Uh-00 for emacs-devel@gnu.org; Sat, 11 Jan 2003 19:34:18 -0500 Original-Received: from eel.dms.auburn.edu (eel.dms.auburn.edu [131.204.53.108]) by manatee.dms.auburn.edu (8.9.1a/8.9.1) with ESMTP id SAA00566; Sat, 11 Jan 2003 18:34:16 -0600 (CST) Original-Received: (from teirllm@localhost) by eel.dms.auburn.edu (8.9.3+Sun/8.9.3) id SAA28513; Sat, 11 Jan 2003 18:34:49 -0600 (CST) X-Authentication-Warning: eel.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: teirllm@dms.auburn.edu In-reply-to: <200301112349.RAA28490@eel.dms.auburn.edu> (message from Luc Teirlinck on Sat, 11 Jan 2003 17:49:39 -0600 (CST)) Original-cc: gmorris+mail@ast.cam.ac.uk X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10676 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10676 Here is the description of the bug in sh-get-indent-info I have been referring to (the description refers to the current CVS): Start with the following buffer in sh-mode. Make sure that the `case' is at the beginning of the buffer. "*" is not really part of the buffer. It denotes the position of point: ===File ~/bobbug.sh========================================= case aa in aa) * ============================================================ Now do M-: (sh-get-indent-info) "Beginning of buffer" error. That is because sh-get-indent-info is doing a (forward-char -1) at the beginning of the buffer. I am not an expert in shell indentation and while I am familiar with certain parts of sh-script.el, I am not very familiar with the indentation machinery. However, the very simple change in the patch below seems to fix the problem. Many people seem to use the convention of starting shell scripts, even ones intended to be sourced, with a comment, be it not a magic comment. For instance, the first line of my .bashrc is: # .bashrc. In that case, the bug will never occur. While in those cases my patch is not necessary, it does no harm either. If that convention is not followed, the patch is necessary. Change log: 2003-01-11 Luc Teirlinck * sh-script.el (sh-get-indent-info): Do not call (forward-char -1) at the beginning of the buffer. Patch: ===File ~/bobdiff=========================================== cd /usr/local/share/emacs/21.3.50/lisp/progmodes/ diff -c /usr/local/share/emacs/21.3.50/lisp/progmodes/sh-script.el /usr/local/share/emacs/21.3.50/lisp/progmodes/sh-script.new.el *** /usr/local/share/emacs/21.3.50/lisp/progmodes/sh-script.el Fri Jan 10 15:48:47 2003 --- /usr/local/share/emacs/21.3.50/lisp/progmodes/sh-script.new.el Sat Jan 11 14:42:43 2003 *************** *** 2036,2042 **** (progn (setq result (append result val)) (setq align-point (point)))) ! (forward-char -1) (skip-chars-forward "[a-z0-9]*?") ) ((string-match "[])}]" x) --- 2036,2042 ---- (progn (setq result (append result val)) (setq align-point (point)))) ! (unless (bobp) (forward-char -1)) (skip-chars-forward "[a-z0-9]*?") ) ((string-match "[])}]" x) Diff finished at Sat Jan 11 14:43:03 ============================================================