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: Sun, 19 Jan 2003 22:25:43 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200301200425.WAA16034@eel.dms.auburn.edu> References: <200301080429.WAA23098@eel.dms.auburn.edu> <200301100436.WAA27007@eel.dms.auburn.edu> <200301120222.UAA28562@eel.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1043036725 27881 80.91.224.249 (20 Jan 2003 04:25:25 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 20 Jan 2003 04:25:25 +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 18aTUx-0007FW-00 for ; Mon, 20 Jan 2003 05:25:23 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18aTff-000091-00 for ; Mon, 20 Jan 2003 05:36:27 +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 18aTVq-0006Xo-04 for emacs-devel@quimby.gnus.org; Sun, 19 Jan 2003 23:26:18 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18aTVC-0005wx-00 for emacs-devel@gnu.org; Sun, 19 Jan 2003 23:25:38 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18aTUv-0005Am-00 for emacs-devel@gnu.org; Sun, 19 Jan 2003 23:25:25 -0500 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18aTUi-0004YK-00 for emacs-devel@gnu.org; Sun, 19 Jan 2003 23:25:09 -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 WAA00393; Sun, 19 Jan 2003 22:25:04 -0600 (CST) Original-Received: (from teirllm@localhost) by eel.dms.auburn.edu (8.9.3+Sun/8.9.3) id WAA16034; Sun, 19 Jan 2003 22:25:43 -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: <200301120222.UAA28562@eel.dms.auburn.edu> (message from Luc Teirlinck on Sat, 11 Jan 2003 20:22:03 -0600 (CST)) Original-cc: gmorris+mail@ast.cam.ac.uk Original-cc: ehud@unix.mvs.co.il 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:10887 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10887 I did not realize that the subject I initiated in another thread (sh-script.el and magic numbers) had already been discussed before. It was not my intention to rediscuss issues on which a decision had already been made. That decision was that sh-script.el should not rely on shell scripts starting with any kind of comment, magic or other. It seems to me that the very fact that the subject seems controversial indicates that this decision was correct, since we are in the business of helping people write in whichever style they choose, not in the business of prescribing programming styles (except, of course, for stuff submitted for inclusion in Emacs). Given that, however, we have at least one problem. (I now believe that the other two problems I referred to, but did not elaborate on, can both be solved, by the user, by giving sh-shell-file a file local value, so I will not go into these.) This leaves the "Beginning of buffer" problem. Trying sh-case (normally bound to C-c C-c) at the very beginning of the buffer pretty soon aborts with this error. Nothing wrong with sh-case or skeletons, `sh-get-indent-info' is to blame, as I reported earlier in this thread. (I really should have made a separate thread out of this, it has nothing to do with skeleton.el.) I could repost my bug reports from more than a week ago if this would seem useful. The problem is, as I explained earlier, that sh-get-indent-info does a (forward-char -1) at the beginning of the buffer. I first (naively) tried (unless (bobp) (forward-char -1)), but this was not good enough. For a correct return value (and hence for correct indentation, in particular of the case form) point really needs to be at position 0, just before the beginning of the buffer. One obvious (but probably contorted and inelegant) way in which the problem can be solved is to add a newline at the beginning of the buffer at the start of sh-get-indent-info, erase it at the end of that function and then replace the resulting (t NUMBER) by (t (1- NUMBER)). A more elegant solution seems to require a good understanding of the entire sh-script.el indentation mechanism. At present, I do not have the time to start studying that mechanism. I have the impression that anybody familiar with that mechanism could come up with a much more elegant solution than the one described above. However, I could implement that solution if it would be considered acceptable and nobody would come up with a better one. (I believe that the only problem with that solution is its stylistic inelegance.) Sincerely, Luc.