[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: skeleton.el machinery eats newlines.
From: |
Luc Teirlinck |
Subject: |
Re: skeleton.el machinery eats newlines. |
Date: |
Sat, 11 Jan 2003 18:34:49 -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 <address@hidden>
* 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
============================================================
- Re: skeleton.el machinery eats newlines., (continued)
- Re: skeleton.el machinery eats newlines., Richard Stallman, 2003/01/10
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/10
- Re: skeleton.el machinery eats newlines., Stefan Monnier, 2003/01/11
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/12
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/12
Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/11
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/11
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/11
- Re: skeleton.el machinery eats newlines., Glenn Morris, 2003/01/11
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/11
- Re: skeleton.el machinery eats newlines.,
Luc Teirlinck <=
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/11
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/11
- Re: skeleton.el machinery eats newlines., Luc Teirlinck, 2003/01/19
Re: skeleton.el machinery eats newlines., Stefan Monnier, 2003/01/11
Re: skeleton.el machinery eats newlines., Stefan Monnier, 2003/01/17
Re: skeleton.el machinery eats newlines., Stefan Monnier, 2003/01/18