Subject: Failing to recognize -- as comment-starter

From: Stefan Monnier <[email-masked]>
Date: Fri, 13 May 2016 16:28:06 -0400

Package: Emacs
Version: 25.1.50

There's a regression on master where a -- comment-starter fails to be
recognized.  This affects haskell-mode.

Put the following in bug-mode.el:

    (defvar bug-mode-syntax-table
      (let ((st (make-syntax-table)))
        (modify-syntax-entry ?- "_ 123" st)
        (modify-syntax-entry ?\n ">" st)
        st))
    
    (define-derived-mode bug-mode prog-mode "BUG"
      "Major mode to exhibit the bug."
      (setq-local font-lock-defaults '(nil))
      (insert "-- hello\n"))

And then

    emacs -Q -l bug-mode.el -f bug-mode

In Emacs-24.5 (and emacs-25) you then see "-- hello" highlighted as
a comment, but on "master" this stays in default face.

        Stefan

In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-17 built on alfajor
Repository revision: 330dcb8fa9dc04fa6b95550774c654435f470277
Windowing system distributor 'The X.Org Foundation', version 11.0.11802000
System Description:	Debian GNU/Linux testing (stretch)

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: fr_CH.UTF-8
  locale-coding-system: utf-8-unix

Major mode: InactiveMinibuffer

Minor modes in effect:
  shell-dirtrack-mode: t
  c-electric-flag: t
  diff-auto-refine-mode: t
  electric-pair-mode: t
  global-reveal-mode: t
  reveal-mode: t
  auto-insert-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  url-handler-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Mark set [2 times]
Auto-saving...done
Mark set [2 times]
Auto-saving...done
Saving file /home/monnier/tmp/foo.el...
Wrote /home/monnier/tmp/foo.el
Saving file /home/monnier/tmp/foo.el...
Wrote /home/monnier/tmp/foo.el
Saving file /home/monnier/tmp/foo.el...
Wrote /home/monnier/tmp/foo.el

Load-path shadows:
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-ref-man hides /home/monnier/src/emacs/elpa/packages/ada-ref-man/ada-ref-man
/home/monnier/src/emacs/elpa/packages/svg/svg hides /home/monnier/src/emacs/work/lisp/svg
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-mode hides /home/monnier/src/emacs/work/lisp/progmodes/ada-mode
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-stmt hides /home/monnier/src/emacs/work/lisp/progmodes/ada-stmt
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-prj hides /home/monnier/src/emacs/work/lisp/progmodes/ada-prj
/home/monnier/src/emacs/elpa/packages/ada-mode/ada-xref hides /home/monnier/src/emacs/work/lisp/progmodes/ada-xref
/home/monnier/src/emacs/elpa/packages/seq/seq hides /home/monnier/src/emacs/work/lisp/emacs-lisp/seq
/home/monnier/src/emacs/elpa/packages/landmark/landmark hides /home/monnier/src/emacs/work/lisp/obsolete/landmark
/home/monnier/src/emacs/elpa/packages/crisp/crisp hides /home/monnier/src/emacs/work/lisp/obsolete/crisp

Features:
(sort mail-extr emacsbug descr-text inf-haskell haskell-font-lock
haskell-doc haskell-indent haskell-mode edmacro kmacro ffap org-element
org-rmail org-mhe org-irc org-info org-gnus org-docview org-bibtex
org-bbdb org-w3m org org-macro org-footnote org-pcomplete org-list
org-faces org-entities org-version ob-emacs-lisp ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-src ob-keys ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs bug-reference whitespace make-mode
bbdb-com bbdb timezone grep cal-french diary-lib diary-loaddefs cal-move
cal-menu calendar cal-loaddefs reftex-cite reftex-parse srecode/document
semantic/doc srecode/semantic semantic/senator semantic/decorate pulse
srecode/extract srecode/insert srecode/filters srecode/find srecode/map
srecode/ctxt srecode/compile srecode/args ede/speedbar ede/files ede
ede/detect ede/base ede/auto ede/source eieio-speedbar eieio-custom
srecode/dictionary srecode/table srecode informat texinfo sm-c-mode
html5-schema rng-xsd xsd-regexp rng-cmpct 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 sgml-mode nxml-util nxml-enc xmltok
eieio-opt nnheader caml tuareg_indent tuareg speedbar sb-image dframe
caml-help caml-types caml-emacs skeleton reftex-dcr reftex
reftex-loaddefs reftex-vars tex-mode compile shell pcomplete latexenc
bibtex-style bibtex log-edit message sendmail format-spec rfc822 mml
mml-sec gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils mailheader pcvs-util smerge-mode add-log vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-dir semantic/bovine/c
semantic/bovine/c-by semantic/lex-spp semantic/idle semantic/bovine/gcc
semantic/dep semantic/bovine semantic/analyze/refs semantic/db-find
semantic/db-ref semantic/analyze semantic/sort semantic/scope
semantic/analyze/fcn semantic/db eieio-base semantic/ctxt
semantic/format ezimage semantic/tag-ls semantic/find
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet hideif cpp cmacexp map cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-langs cc-vars
cc-defs help-fns xscheme warnings unsafep trace testcover shadow scheme
re-builder profiler inf-lisp ielm comint ansi-color gmm-utils ert pp
find-func ewoc elp edebug cl-indent epa-file epa epg autorevert
filenotify doc-view subr-x jka-compr image-mode dired dired-loaddefs
executable copyright dabbrev debug misearch multi-isearch coq-mmm
mmm-auto mmm-vars mmm-utils mmm-compat coq-unicode-tokens
proof-unicode-tokens vc vc-dispatcher vc-git diff-mode filecache
which-func imenu coq coq-smie smie coq-indent coq-par-compile
coq-seq-compile coq-compile-common coq-abbrev coq-local-vars
local-vars-list coq-syntax coq-db holes proof proof-shell pg-user
completion pg-goals pg-response proof-toolbar pg-assoc proof-tree
proof-script proof-menu cus-edit cus-start cus-load wid-edit span cl-seq
proof-auxmodes proof-utils scomint proof-syntax bufhist ring
proof-splash derived pg-custom proof-config proof-faces proof-useropts
pg-pamacs proof-compat server time-date noutline outline easy-mmode
flyspell ispell checkdoc thingatpt load-dir elec-pair reveal autoinsert
proof-site proof-autoloads cl pg-vars savehist minibuf-eldef disp-table
advice info finder-inf url-auth package epg-config url-handlers
url-parse auth-source eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cl-extra
help-mode easymenu cconv cl-loaddefs pcase cl-lib bbdb-loaddefs
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame 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 charscript
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
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 dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 8 1038409 179535)
 (symbols 24 60085 0) (miscs 20 9261 2533) (strings 16 200906 12349)
 (string-bytes 1 6727120)
 (vectors 8 106251) (vector-slots 4 3347424 190136) (floats 8 1681 831)
 (intervals 28 68135 1882)
 (buffers 520 125) (heap 1024 1254385 4228))