GNU bug report logs - #11946
syntax highlighting error in sh-mode

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>

Date: Sun, 15 Jul 2012 20:53:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11946 in the body.
You can then email your comments to 11946 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11946; Package emacs. (Sun, 15 Jul 2012 20:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thierry Volpiatto <thierry.volpiatto <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 15 Jul 2012 20:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: syntax highlighting error in sh-mode 
Date: Sun, 15 Jul 2012 22:46:27 +0200
Hi, the following after the "#" is taken as a comment, which is wrong:

VERSION[${#VERSION[*]}]=$i

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11946; Package emacs. (Mon, 16 Jul 2012 07:15:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#11946: syntax highlighting error in sh-mode
Date: Mon, 16 Jul 2012 09:08:45 +0200
Thierry Volpiatto <thierry.volpiatto <at> gmail.com> writes:

> Hi, the following after the "#" is taken as a comment, which is wrong:
>
> VERSION[${#VERSION[*]}]=$i

Should be visible here:

#+BEGIN_SRC sh
declare -a VERSION
for i in $(ls "$PREFIX/sbin") ; do
    echo -e $N')' $i
    VERSION[${#VERSION[*]}]=$i
    N=$(($N + 1))
done

#+END_SRC

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Tue, 17 Jul 2012 08:46:02 GMT) Full text and rfc822 format available.

Notification sent to Thierry Volpiatto <thierry.volpiatto <at> gmail.com>:
bug acknowledged by developer. (Tue, 17 Jul 2012 08:46:03 GMT) Full text and rfc822 format available.

Message #13 received at 11946-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Cc: 11946-done <at> debbugs.gnu.org
Subject: Re: bug#11946: syntax highlighting error in sh-mode
Date: Tue, 17 Jul 2012 04:38:54 -0400
> Hi, the following after the "#" is taken as a comment, which is wrong:
> VERSION[${#VERSION[*]}]=$i

Thanks, installed the patch below in trunk to fix this problem.


        Stefan


--- lisp/progmodes/sh-script.el	2012-07-10 11:51:54 +0000
+++ lisp/progmodes/sh-script.el	2012-07-17 08:19:01 +0000
@@ -1087,7 +1087,7 @@
     ;; metacharacters.  The list of special chars is taken from
     ;; the single-unix spec of the shell command language (under
     ;; `quoting') but with `$' removed.
-    ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_"))
+    ("\\(?:[^|&;<>()`\\\"' \t\n]\\|\\${\\)\\(#+\\)" (1 "_"))
     ;; In a '...' the backslash is not escaping.
     ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote)))
     ;; Make sure $@ and $? are correctly recognized as sexps.





Message #14 received at 11946-done <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 11946-done <at> debbugs.gnu.org
Subject: Re: bug#11946: syntax highlighting error in sh-mode
Date: Tue, 17 Jul 2012 12:21:36 +0200
Hi Stefan,

Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> Thanks, installed the patch below in trunk to fix this problem.

Thanks, it fix the problem but not fully; when I edit in the buffer the
coloration is ok, but if I kill buffer and reopen it the line:

VERSION[${#VERSION[*]}]=$i

is Ok, but this one:

LEN=${#BIN[@]}

is not now (i.e colorized as a comment after #)

and then if I edit this line

LEN=${#BIN[@]}

the one above:

VERSION[${#VERSION[*]}]=$i

look as a comment after #.

If I edit it (e.g remove '}' and put it back), the color becomes correct
(i.e no comment color)

Here the full snippet of code if you want to reproduce:

--8<---------------cut here---------------start------------->8---
LEN=${#BIN[@]}

N=1
declare -a VERSION
for i in $(ls "$PREFIX/sbin") ; do
    echo -e $N')' $i
    VERSION[${#VERSION[*]}]=$i
    N=$(($N + 1))
done
--8<---------------cut here---------------end--------------->8---

I can send you the full file if you want.


-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




Message #15 received at 11946-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Cc: 11946-done <at> debbugs.gnu.org
Subject: Re: bug#11946: syntax highlighting error in sh-mode
Date: Tue, 17 Jul 2012 07:57:06 -0400
> Thanks, it fix the problem but not fully; when I edit in the buffer the

I believe what you're seeing is a result of another bug which I recently
fixed in emacs-24 but hasn't yet been merged into trunk.

I've now sync'd trunk with emacs-24 so please try again,


        Stefan




Message #16 received at 11946-done <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 11946-done <at> debbugs.gnu.org
Subject: Re: bug#11946: syntax highlighting error in sh-mode
Date: Tue, 17 Jul 2012 16:15:14 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>> Thanks, it fix the problem but not fully; when I edit in the buffer the
>
> I believe what you're seeing is a result of another bug which I recently
> fixed in emacs-24 but hasn't yet been merged into trunk.
>
> I've now sync'd trunk with emacs-24 so please try again,
Ok it is working fine now, thanks.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 15 Aug 2012 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 312 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.