emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Indentation in shell-script-mode in combination with global-font-lo


From: Lute Kamstra
Subject: Re: Indentation in shell-script-mode in combination with global-font-lock-mode.
Date: Fri, 01 Aug 2003 12:22:58 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Lute Kamstra <address@hidden> writes:

> I start Emacs with
>
>   emacs -q --no-site-file example.sh
>
> to end up in shell-script-mode.
>
> Lines terminated with an `\' are now indented as follows:
>
> first \
>     second
>
> If I start font-locking by typing M-x global-font-lock-mode
> indentation is like this:
>
> first \
> second

The bug is introduced by this change:

2003-06-01  Stefan Monnier  <address@hidden>

        * progmodes/sh-script.el (sh-is-quoted-p): New fun.
        (sh-font-lock-paren): Use it to allow \C in case patterns.
        (sh-get-indent-info): Check the \n before the line for string-status.
        (sh-feature): Remove unused var `function'.
        (sh-get-indent-info): Remove unused variables.
        (sh-prev-thing): Remove unused vars `going', `n', and `found'.
        (sh-set-indent): Remove unused var `new-val' and `val0'.
        (sh-learn-buffer-indent): Remove unused vars `last-pos' and `lines'.
        (sh-guess-basic-offset): Remove unused var `return' and `j'.

sh-get-indent-info is changed so that it checks the font of 
(-1 (line-beginning-position)) as opposed to the font of
(line-beginning-position) to determine the string status.

With font-locking, the \ at the end of the line causes the \n
following it to have font-lock-string-face, thus sh-get-indent-info
erroneously concludes that it is inside a string and signals not to do
any indenting for the current line.  So checking the preceding \n for
font-lock-string-face is not a safe way to determine the string
status.

Stefan, do you remember why checking the face of
(line-beginning-position) wasn't good enough?


  Lute.


PS I'm going on vacation for the next 2 weeks so don't be surprised if
   I don't respond to email for a while.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]