Subject: bug#7921: 23.2.91; js-mode font lock problem with comments

From: Evan Owens <[email-masked]>
Date: Wed, 26 Jan 2011 09:56:37 -0500

--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 [email-masked] 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)