bug#38363: Error in mhtml-syntax-propertize in HTML with inline script

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#38363: Error in mhtml-syntax-propertize in HTML with inline script

Richard Copley-2
HTML with inline script can cause an error in mhtml-syntax-propertize.

Recipe from emacs -Q: Visit a new file "index.html" and insert these contents:

<html>
  <head>
    <script> 0 </script>
  </head>
  <body>
    it's
  </body>
</html>

Put the cursor after the zero and type a semicolon. An error is signalled.

(Note the "unmatched" apostrophe in the HTML body.)

Errors:
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument number-or-marker-p nil)
mhtml-syntax-propertize: Wrong type argument: number-or-marker-p, nil

Backtrace:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  sgml--syntax-propertize-ppss(86)
  mhtml-syntax-propertize(33 107)
  syntax-propertize(50)
  syntax-ppss()
  electric-indent-post-self-insert-function()
  self-insert-command(1 59)
  funcall-interactively(self-insert-command 1 59)
  call-interactively(self-insert-command nil nil)
  command-execute(self-insert-command)

In GNU Emacs 27.0.50 (build 6, x86_64-w64-mingw32)
 of 2019-11-24 built on MACHINE
Repository revision: 5a3e96b17c2a948ac952295962dc6e281ec5cad5
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.19025
System Description: Microsoft Windows 10 Pro (v10.0.1903.19025.1051)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Mark set
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument number-or-marker-p nil)
mhtml-syntax-propertize: Wrong type argument: number-or-marker-p, nil
Configured using:
 'configure --config-cache --with-modules --without-pop --without-dbus
 --without-gconf --without-gsettings CFLAGS=-O2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: ENG
  locale-coding-system: cp1252

Major mode: HTML+JS

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc dired dired-loaddefs rfc822
mml mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail vc-git
diff-mode easy-mmode mhtml-mode css-mode smie eww mm-url gnus nnheader
gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums time-date
mail-utils wid-edit mm-util mail-prsvr thingatpt url-queue url url-proxy
url-privacy url-expand url-methods url-history mailcap shr
text-property-search url-cookie url-domsuf url-util url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars puny svg xml browse-url format-spec color js
json subr-x map imenu cc-mode cc-fonts easymenu cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs sgml-mode seq
byte-opt gv bytecomp byte-compile cconv dom cl-loaddefs cl-lib tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 113316 8380)
 (symbols 48 13210 1)
 (strings 32 40080 2328)
 (string-bytes 1 1310957)
 (vectors 16 18724)
 (vector-slots 8 235664 6880)
 (floats 8 204 73)
 (intervals 56 264 0)
 (buffers 1000 12))

Reply | Threaded
Open this post in threaded view
|

bug#38372: Error in mhtml-syntax-propertize in HTML with inline script

Richard Copley-2
HTML with inline script can cause an error in mhtml-syntax-propertize.

Recipe from emacs -Q: Visit a new file "index.html" and insert these contents:

<html>
  <head>
    <script> 0 </script>
  </head>
  <body>
    it's
  </body>
</html>

Put the cursor after the zero and type a semicolon. An error is signalled.

(Note the "unmatched" apostrophe in the HTML body.)

Errors:
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument number-or-marker-p nil)
mhtml-syntax-propertize: Wrong type argument: number-or-marker-p, nil

Backtrace:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  sgml--syntax-propertize-ppss(86)
  mhtml-syntax-propertize(33 107)
  syntax-propertize(50)
  syntax-ppss()
  electric-indent-post-self-insert-function()
  self-insert-command(1 59)
  funcall-interactively(self-insert-command 1 59)
  call-interactively(self-insert-command nil nil)
  command-execute(self-insert-command)

In GNU Emacs 27.0.50 (build 6, x86_64-w64-mingw32)
 of 2019-11-24 built on MACHINE
Repository revision: 5a3e96b17c2a948ac952295962dc6e281ec5cad5
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.19025
System Description: Microsoft Windows 10 Pro (v10.0.1903.19025.1051)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Mark set
Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument number-or-marker-p nil)
mhtml-syntax-propertize: Wrong type argument: number-or-marker-p, nil
Configured using:
 'configure --config-cache --with-modules --without-pop --without-dbus
 --without-gconf --without-gsettings CFLAGS=-O2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: ENG
  locale-coding-system: cp1252

Major mode: HTML+JS

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc dired dired-loaddefs rfc822
mml mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail vc-git
diff-mode easy-mmode mhtml-mode css-mode smie eww mm-url gnus nnheader
gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums time-date
mail-utils wid-edit mm-util mail-prsvr thingatpt url-queue url url-proxy
url-privacy url-expand url-methods url-history mailcap shr
text-property-search url-cookie url-domsuf url-util url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars puny svg xml browse-url format-spec color js
json subr-x map imenu cc-mode cc-fonts easymenu cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs sgml-mode seq
byte-opt gv bytecomp byte-compile cconv dom cl-loaddefs cl-lib tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 113316 8380)
 (symbols 48 13210 1)
 (strings 32 40080 2328)
 (string-bytes 1 1310957)
 (vectors 16 18724)
 (vector-slots 8 235664 6880)
 (floats 8 204 73)
 (intervals 56 264 0)
 (buffers 1000 12))
Reply | Threaded
Open this post in threaded view
|

bug#38372: Error in mhtml-syntax-propertize in HTML with inline script

Dmitry Gutov
On 25.11.2019 18:57, Richard Copley wrote:

> HTML with inline script can cause an error in mhtml-syntax-propertize.
>
> Recipe from emacs -Q: Visit a new file "index.html" and insert these
> contents:
>
> <html>
>    <head>
>      <script> 0 </script>
>    </head>
>    <body>
>      it's
>    </body>
> </html>
>
> Put the cursor after the zero and type a semicolon. An error is signalled.
>
> (Note the "unmatched" apostrophe in the HTML body.)
>
> Errors:
> Error during redisplay: (jit-lock-function 1) signaled
> (wrong-type-argument number-or-marker-p nil)
> mhtml-syntax-propertize: Wrong type argument: number-or-marker-p, nil
>
> Backtrace:
> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>    sgml--syntax-propertize-ppss(86)
>    mhtml-syntax-propertize(33 107)
>    syntax-propertize(50)
>    syntax-ppss()
>    electric-indent-post-self-insert-function()
>    self-insert-command(1 59)
>    funcall-interactively(self-insert-command 1 59)
>    call-interactively(self-insert-command nil nil)
>    command-execute(self-insert-command)

Seems it's only triggered when electric-indent-mode is on.

And the error is in sgml--syntax-propertize-ppss, a function that was
added after mhtml-mode was written.

A quick attempt at fixing it (adding "sgml--syntax-" to
mhtml--crucial-variable-prefix) didn't help, so I'm just going to Cc the
people who might have better idea.



Reply | Threaded
Open this post in threaded view
|

bug#38372: Error in mhtml-syntax-propertize in HTML with inline script

Stefan Monnier
> A quick attempt at fixing it (adding "sgml--syntax-" to
>   mhtml--crucial-variable-prefix) didn't help, so I'm just going to Cc the
> people who might have better idea.

I just pushed a fix for it.


        Stefan




Reply | Threaded
Open this post in threaded view
|

bug#38372: Error in mhtml-syntax-propertize in HTML with inline script

Tom Tromey-4
>> Can this bug be closed then?

Stefan> I think so, but it would be good to get confirmation from someone who
Stefan> actually experienced this problem.

No response for quite a while, and it's fixed, so I am closing it.

Tom