unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: skeleton.el machinery eats newlines.
Date: Sat, 11 Jan 2003 18:34:49 -0600 (CST)	[thread overview]
Message-ID: <200301120034.SAA28513@eel.dms.auburn.edu> (raw)
In-Reply-To: <200301112349.RAA28490@eel.dms.auburn.edu> (message from Luc Teirlinck on Sat, 11 Jan 2003 17:49:39 -0600 (CST))

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  <teirllm@mail.auburn.edu>

        * 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
============================================================

  reply	other threads:[~2003-01-12  0:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-08  4:29 skeleton.el machinery eats newlines Luc Teirlinck
2003-01-10  4:36 ` Luc Teirlinck
2003-01-10  6:24   ` Luc Teirlinck
2003-01-10 15:33     ` Luc Teirlinck
2003-01-11  0:21     ` Richard Stallman
2003-01-11  2:35       ` Luc Teirlinck
2003-01-11 19:27       ` Stefan Monnier
2003-01-12 17:10         ` Luc Teirlinck
2003-01-12 19:05           ` Luc Teirlinck
2003-01-11 21:44   ` Luc Teirlinck
2003-01-11 21:49     ` Luc Teirlinck
2003-01-11 22:27     ` Luc Teirlinck
2003-01-11 23:45     ` Glenn Morris
2003-01-11 23:49       ` Luc Teirlinck
2003-01-12  0:34         ` Luc Teirlinck [this message]
2003-01-12  1:20           ` Luc Teirlinck
2003-01-12  2:22             ` Luc Teirlinck
2003-01-20  4:25               ` Luc Teirlinck
2003-01-11 19:43 ` Stefan Monnier
2003-01-11 21:29   ` Luc Teirlinck
2003-01-12  5:23   ` Luc Teirlinck
2003-01-12  6:14   ` Luc Teirlinck
2003-01-17 20:37 ` Stefan Monnier
2003-01-18  1:43   ` Luc Teirlinck
2003-01-18 20:41 ` Stefan Monnier
2003-01-19  1:02   ` Luc Teirlinck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301120034.SAA28513@eel.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).