GNU bug report logs - #7921
23.2.91; js-mode font lock problem with comments

Previous Next

Package: emacs;

Reported by: Evan Owens <eaowens <at> gmail.com>

Date: Wed, 26 Jan 2011 16:03:02 UTC

Severity: minor

Found in version 23.2.91

Done: Simen Heggestøyl <simenheg <at> gmail.com>

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 7921 in the body.
You can then email your comments to 7921 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Wed, 26 Jan 2011 16:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Evan Owens <eaowens <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 26 Jan 2011 16:03:02 GMT) Full text and rfc822 format available.

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

From: Evan Owens <eaowens <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2.91; js-mode font lock problem with comments
Date: Wed, 26 Jan 2011 09:56:37 -0500
[Message part 1 (text/plain, inline)]
--text follows this line--
This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your report will be posted to the bug-gnu-emacs <at> gnu.org mailing list
and the gnu.emacs.bug news group, and at http://debbugs.gnu.org.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug.  If you can, give
a recipe starting from `emacs -Q':

Given an HTML/JS file with the following content:

<h1>Here is some HTML</h1>

<script type="text/javascript">
Event.onDOMReady(function() {
    // comment one
    function createCookie(name, value, expires) {
        if (expires) {
            var date = new Date();
            date.setTime(date.getTime()+(expires*24*60*60*1000));
            expires = "; expires="+date.toGMTString();
        } else {
            expires = '';
        }
        document.cookie = name+"="+value+expires+"; path=/";
    };

    if ($('discount-details-link')) {  // comment two
        Event.observe($('discount-details-link'), 'click', function() {
            Effect.Appear('discount-popup');
        });
    }
    // nXhtml seems to think everything below comment two is a string...
});
</script>


Note that everything under "// comment two" is fontified as a string.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
c:/cygwin/usr/local/emacs/emacs-23.2.91/etc/DEBUG.


In GNU Emacs 23.2.91.1 (i386-mingw-nt6.1.7600)
 of 2010-12-11 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 6.1.7600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Javascript

Minor modes in effect:
  show-paren-mode: t
  icomplete-mode: t
  global-hl-line-mode: t
  nxhtml-menu-mode: t
  nxhtml-tag-do-also: t
  popcmp-group-alternatives: t
  popcmp-short-help-beside-alts: t
  shell-dirtrack-mode: t
  mlinks-active-links: t
  recentf-mode: t
  rngalt-minimal-validation-header: t
  rngalt-display-validation-header: t
  global-ede-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  flymake-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: (only . t)

Recent input:
<wheel-down> <double-wheel-down> <triple-wheel-down>
<wheel-down> <double-wheel-down> <triple-wheel-down>
<triple-wheel-down> <triple-wheel-down> <triple-wheel-down>
<wheel-down> <double-wheel-down> <triple-wheel-down>
<triple-wheel-down> <triple-wheel-down> <triple-wheel-down>
<down-mouse-1> <mouse-1> C-x C-f C-a C-f C-a <C-right>
<C-right> <C-left> C-k U s e r <tab> E v <tab> SPC
O <tab> D o <tab> w <tab> t e <tab> s <tab> <return>
<down> <down> C-x 1 <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <up> <up> <up> <up> <up> <up> <up> <down>
<down> <down> <down> <down> <down> <down> <down> <up>
<up> <up> <up> <up> <up> <up> <escape> x r e p o r
t <tab> <return> <help-echo> <down-mouse-1> <mouse-movement>
<mouse-1> <help-echo> f o n t <backspace> <down-mouse-1>
<mouse-movement> <drag-mouse-1> <up> <up> <escape>
x j s C-g <up> <up> <up> C-_ <up> <up> <escape> x j
s SPC m o d e <return> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <up> <up> <up> <up>
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>
<mouse-movement> <mouse-movement> <drag-mouse-1> <escape>
x r e p o <tab> t <tab> e <backspace> <backspace> r
<tab> e <backspace> <return>

Recent messages:
Using vacuous schema
Error in menu-bar-update-hook: (error This buffer cannot use
`imenu-default-create-index-function')
byte-code: Command attempted to use minibuffer while in minibuffer
Quit
Undo!
Using vacuous schema [3 times]
Fontifying test.php... (syntactically...)
Using vacuous schema
Mark set
Making completion list...

Load-path shadows:
c:/cygwin/usr/local/emacs/site-lisp/nxhtml-devel/util/ack hides
c:/cygwin/usr/local/emacs/emacs-23.2.91/../site-lisp/ack
c:/cygwin/usr/local/emacs/site-lisp/ecb/ecb2/test hides
c:/cygwin/usr/local/emacs/site-lisp/elim/elisp/test
c:/cygwin/usr/local/emacs/site-lisp/nxhtml-devel/related/php-mode hides
c:/cygwin/usr/local/emacs/site-lisp/emacs-symfony/t/extlib/php-mode
c:/cygwin/usr/local/emacs/emacs-23.2.91/../site-lisp/auto-complete hides
c:/cygwin/usr/local/emacs/site-lisp/emacs-symfony/t/extlib/auto-complete
c:/cygwin/usr/local/emacs/emacs-23.2.91/../site-lisp/anything hides
c:/cygwin/usr/local/emacs/site-lisp/emacs-symfony/t/extlib/anything
c:/cygwin/usr/local/emacs/site-lisp/anything-project/anything-project hides
c:/cygwin/usr/local/emacs/site-lisp/emacs-symfony/t/extlib/anything-project
c:/cygwin/usr/local/emacs/emacs-23.2.91/../site-lisp/anything-match-plugin
hides
c:/cygwin/usr/local/emacs/site-lisp/emacs-symfony/t/extlib/anything-match-plugin
c:/cygwin/usr/local/emacs/emacs-23.2.91/../site-lisp/anything-grep hides
c:/cygwin/usr/local/emacs/site-lisp/emacs-symfony/t/extlib/anything-grep

Features:
(shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache
mailabbrev gmm-utils mailheader canlock hashcash emacsbug js json
newcomment nxml-uchnm rng-xsd xsd-regexp rng-cmpct subword nxhtml-mumamo
mumamo-fun mumamo-chunks amrita nxhtml paren icomplete hl-line
flymake-files flymakemsg nxhtml-autostart nxhtml-autoload moz majmodpri
vc-bzr sha1 hex-util nxhtml-menu udev-rinari udev-ecb udev css-color
nxhtml-mode html-quote tidy-xhtml ediff-merg ediff-diff ediff-wind
ediff-help ediff-util ediff-mult ediff-init ediff html-imenu imenu
loadhist popcmp xhtml-help html-toc xml fupd html-pagetoc appmenu-fold
fold-dwim tex-mode shell inlimg html-write mlinks appmenu help-mode view
html-upl html-site ffip gimpedit foldit dired web-vcs url-http tls
url-auth url-gw mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 qp ietf-drums web-autoload ourcomments-widgets ourcomments-util
cus-edit cus-start cus-load uniquify recentf tree-widget mm-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
mailcap gnus gnus-ems nnheader gnus-util netrc mail-utils org
org-footnote org-src org-list org-faces org-compat org-macs time-date
noutline outline ido bookmark pp apropos mumamo sgml-mode ruby-mode
rngalt rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match
rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap
nxml-util nxml-glyph nxml-enc xmltok mumamo-cmirr flyspell ispell
desktop nxhtml-base auto-complete-config ede/linux ede/emacs
ede/cpp-root ede/speedbar ede/files ede ede/base ede/auto ede/source
eieio-speedbar eieio-custom symfony php-completion easy-mmode
auto-complete popup url-util url-parse url-vars mm-util mail-prsvr
browse-url anything-project php-mode cc-langs cc-mode cc-fonts cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs add-log etags rx
showtip saveplace hidesearch hide-lines gtags flymake-extension
fringe-helper flymake ecb warnings ecb-symboldef ecb-analyse
ecb-compatibility ecb-winman-support ecb-autogen autoload ecb-tod
ecb-cycle ecb-eshell ecb-help ecb-jde ecb-method-browser hideshow
ecb-semantic ecb-file-browser ecb-speedbar ecb-layout ecb-create-layout
ecb-compilation ecb-common-browser speedbar sb-image dframe assoc
ecb-navigate ecb-mode-line ecb-face tree-buffer ecb-upgrade
ecb-cedet-wrapper semantic/db-mode semantic/db-find semantic/db-ref
semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn
semantic/db eieio-base semantic/format ezimage semantic/tag-ls
semantic/ctxt semantic/util-modes easymenu semantic/util semantic
semantic/tag semantic/lex semantic/fw eieio byte-opt bytecomp
byte-compile mode-local cedet wid-edit ecb-util thingatpt silentcomp
browse-kill-ring derived anything-match-plugin anything-grep grep
compile anything advice advice-preload help-fns edmacro kmacro sort
cygwin-mount ange-ftp regexp-opt comint ring executable cl cl-19 tooltip
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table ls-lisp
w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process multi-tty emacs)
[Message part 2 (text/html, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Wed, 26 Jan 2011 17:36:01 GMT) Full text and rfc822 format available.

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

From: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
To: Evan Owens <eaowens <at> gmail.com>
Cc: 7921 <at> debbugs.gnu.org
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Wed, 26 Jan 2011 18:43:04 +0100
I can reproduce this with only js-mode and all the HTML removed from
the example. Other reproducible issues, modifying the line ending with
path=/"; are:

path=/";/ # Everything following and including the last / is string face
path="; # Everything is fine
path=//"; # Everything is fine

--
Deniz Dogan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Wed, 26 Jan 2011 17:43:02 GMT) Full text and rfc822 format available.

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

From: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
To: Evan Owens <eaowens <at> gmail.com>
Cc: 7921 <at> debbugs.gnu.org
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Wed, 26 Jan 2011 18:50:34 +0100
Bug #7882 (24.0.50; Bad regexp for javascript regexps) is possibly related.

-- 
Deniz Dogan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Wed, 26 Jan 2011 19:23:01 GMT) Full text and rfc822 format available.

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

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
Cc: 7921 <at> debbugs.gnu.org, Evan Owens <eaowens <at> gmail.com>
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Wed, 26 Jan 2011 20:30:13 +0100
On Wed, Jan 26, 2011 at 6:43 PM, Deniz Dogan <deniz.a.m.dogan <at> gmail.com> wrote:
> I can reproduce this with only js-mode and all the HTML removed from
> the example. Other reproducible issues, modifying the line ending with
> path=/"; are:
>
> path=/";/ # Everything following and including the last / is string face
> path="; # Everything is fine
> path=//"; # Everything is fine

Fine. Then I assume that this is an Emacs bug, not a nXhtml bug. If it
turns out not to be an Emacs bug please repost it as on nXhtml on
Launchpad.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Thu, 27 Jan 2011 03:15:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
Cc: 7921 <at> debbugs.gnu.org, Evan Owens <eaowens <at> gmail.com>
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Wed, 26 Jan 2011 22:22:19 -0500
> path=/";/ # Everything following and including the last / is string face
> path="; # Everything is fine
> path=//"; # Everything is fine

I've put the above three lines in ~/tmp/foo.js and opened it with
Debian's emacs23 and I don't think I see the problems you describe in
the comments.  OTOH I see other problems of highlighting but they're
largely due to the code itself being meaningless, AFAIK (# is not
a comment marker in javascript, is it?).


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Thu, 27 Jan 2011 03:20:03 GMT) Full text and rfc822 format available.

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

From: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7921 <at> debbugs.gnu.org, Evan Owens <eaowens <at> gmail.com>
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Thu, 27 Jan 2011 04:26:53 +0100
2011/1/27 Stefan Monnier <monnier <at> iro.umontreal.ca>:
>> path=/";/ # Everything following and including the last / is string face
>> path="; # Everything is fine
>> path=//"; # Everything is fine
>
> I've put the above three lines in ~/tmp/foo.js and opened it with
> Debian's emacs23 and I don't think I see the problems you describe in
> the comments.  OTOH I see other problems of highlighting but they're
> largely due to the code itself being meaningless, AFAIK (# is not
> a comment marker in javascript, is it?).
>

I'm sorry, I should have been more clear. The # signs are
meta-comments, please leave them out when trying to reproduce the
problem.

-- 
Deniz Dogan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Thu, 27 Jan 2011 17:15:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
Cc: 7921 <at> debbugs.gnu.org, Evan Owens <eaowens <at> gmail.com>
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Thu, 27 Jan 2011 12:22:52 -0500
>>> path=/";/ # Everything following and including the last / is string face
>>> path="; # Everything is fine
>>> path=//"; # Everything is fine
>> 
>> I've put the above three lines in ~/tmp/foo.js and opened it with
>> Debian's emacs23 and I don't think I see the problems you describe in
>> the comments.  OTOH I see other problems of highlighting but they're
>> largely due to the code itself being meaningless, AFAIK (# is not
>> a comment marker in javascript, is it?).
>> 

> I'm sorry, I should have been more clear. The # signs are
> meta-comments, please leave them out when trying to reproduce the
> problem.

In my tests, the ";\npath=//" is treated as a string.  This sounds right
to me, but not being a js-programmer, your example makes me doubt.
IOW, using the latest code in the emacs-23, are there still some issues
with js-mode's font-locking?


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7921; Package emacs. (Thu, 27 Jan 2011 17:27:02 GMT) Full text and rfc822 format available.

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

From: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7921 <at> debbugs.gnu.org, Evan Owens <eaowens <at> gmail.com>
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Thu, 27 Jan 2011 18:33:56 +0100
2011/1/27 Stefan Monnier <monnier <at> iro.umontreal.ca>:
>>>> path=/";/ # Everything following and including the last / is string face
>>>> path="; # Everything is fine
>>>> path=//"; # Everything is fine
>>>
>>> I've put the above three lines in ~/tmp/foo.js and opened it with
>>> Debian's emacs23 and I don't think I see the problems you describe in
>>> the comments.  OTOH I see other problems of highlighting but they're
>>> largely due to the code itself being meaningless, AFAIK (# is not
>>> a comment marker in javascript, is it?).
>>>
>
>> I'm sorry, I should have been more clear. The # signs are
>> meta-comments, please leave them out when trying to reproduce the
>> problem.
>
> In my tests, the ";\npath=//" is treated as a string.  This sounds right
> to me, but not being a js-programmer, your example makes me doubt.
> IOW, using the latest code in the emacs-23, are there still some issues
> with js-mode's font-locking?
>

Assuming that you mean "; npath=//", it is indeed correctly fontified
as a string.

I notice now that I referred to the three JavaScript examples as
"issues" -- they are not issues.

Only the last two examples are valid JavaScript. The first example,
even though _invalid_ JavaScript, might give us a hint about what the
problem is. That is the only reason why I included it.

-- 
Deniz Dogan




Reply sent to Simen Heggestøyl <simenheg <at> gmail.com>:
You have taken responsibility. (Sun, 07 Feb 2016 20:24:01 GMT) Full text and rfc822 format available.

Notification sent to Evan Owens <eaowens <at> gmail.com>:
bug acknowledged by developer. (Sun, 07 Feb 2016 20:24:01 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Deniz Dogan <deniz.a.m.dogan <at> gmail.com>
Cc: monnier <at> iro.umontreal.ca, eaowens <at> gmail.com, 7921-done <at> debbugs.gnu.org
Subject: Re: bug#7921: 23.2.91; js-mode font lock problem with comments
Date: Sun, 07 Feb 2016 21:23:15 +0100
It seems this was fixed by 6cd1834. I can reproduce the bug with
versions of js.el before that revision, but not after.

Please reopen if you find that's not the case.

-- Simen




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 07 Mar 2016 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 164 days ago.

Previous Next


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