Subject: bug#16620: 24.3.50; Font-lock rule for `ert' does not handle words with dashes (fix included)

From: Anders Lindgren <[email-masked]>
Date: Sun, 2 Feb 2014 00:36:49 +0100

The package `ert', adds Font Lock keywords to highlight the `ert-deftest'
construct. Unfortunately, the regexp used does not handle the case when the
name of the test contains a dash.

For example, here only "alpha" is highlighted:

    (ert-deftest alpha-beta ()

This could easily be fixed by replacing the original regexp:

    "(\\(\\<ert-deftest\\)\\>\\s *\\(\\sw+\\)?"

with (which is the construct used to highlight `defun'):

    "(\\(\\<ert-deftest\\)\\>\\s *\\(\\(?:\\sw\\|\\s_\\)+\\)?"

See `ert--activate-font-lock-keywords' in the file `ert.el'.

    -- Anders

In GNU Emacs 24.3.50.4 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
 of 2014-01-16 on macpro.lan
Repository revision: 116039
[email-masked]
Windowing system distributor `Apple', version 10.3.1265
Configured using:
 `configure --with-ns'

Important settings:
  value of $LC_CTYPE: UTF-8
  locale-coding-system: utf-8-unix

Major mode: Font-Lock-Studio

Minor modes in effect:
  shell-dirtrack-mode: t
  global-auto-revert-mode: t
  global-cwarn-mode: t
  minibuffer-electric-file-mode: t
  recentf-mode: t
  msb-mode: t
  display-time-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
a n SPC t h e SPC s a m e SPC t h e <backspace> i n
g . C-a C-x C-s C-v C-v <escape> < C-s e x p l a i
n ( <backspace> C-s C-s C-s C-s C-s C-a <escape> <
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> M-f M-f M-f
s SPC " e x p l a n <backspace> <backspace> a i n "
SPC a n d SPC <escape> q M-f M-f M-f <left> <left>
<left> <left> <left> <backspace> C-a C-x C-s C-v C-v
C-v C-M-e C-M-e C-M-e C-M-e C-M-e C-M-e C-M-e C-M-e
C-M-e <down> <down> M-f M-f <right> SPC <backspace>
C-SPC C-M-f <escape> w C-a C-x C-s C-x C-f <down> <return>
C-x k <return> C-x C-f <up> <return> C-v <escape> x
f o n t - o <backspace> l o c <tab> s t <tab> <return>
<down> <down> M-f <right> C-s C-w C-w C-w C-w C-w C-s
C-s C-r C-r C-a <up> <up> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> C-SPC <right> <right> <right> <right> <left>
<left> <left> <left> <left> <left> <left> C-SPC <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <escape> w <right>
<escape> w <escape> x e r <backspace> <backspace> r
e p o r t - e <backspace> e m <tab> <return>

Recent messages:
Mark set
Matches
"(\\(cl-def\\(?:macro\\|s\\(?:\\(?:truc\\|ubs\\)t\\)\\|type\\|un\\)\\|def\\(?:a\\(?:dvice\\|lias\\)\\|c\\(?:lass\\|onst\\|ustom\\)\\|face\\|g\\(?:eneric\\|roup\\)\\|ine-\\(?:derived-mode\\|g\\(?:\\(?:eneric\\|lobal\\(?:\\(?:ized\\)?-minor\\)\\)-mode\\)\\|minor-mode\\|skeleton\\|widget\\)\\|m\\(?:acro\\|ethod\\)\\|subst\\|theme\\|un\\|var\\(?:-local\\|alias\\)?\\)\\)\\_>[
\t'(]*\\(\\(?:\\sw\\|\\s_\\)... [+1] [2 times]
Matches
"(\\(cl-def\\(?:macro\\|s\\(?:\\(?:truc\\|ubs\\)t\\)\\|type\\|un\\)\\|def\\(?:a\\(?:dvice\\|lias\\)\\|c\\(?:lass\\|onst\\|ustom\\)\\|face\\|g\\(?:eneric\\|roup\\)\\|ine-\\(?:derived-mode\\|g\\(?:\\(?:eneric\\|lobal\\(?:\\(?:ized\\)?-minor\\)\\)-mode\\)\\|minor-mode\\|skeleton\\|widget\\)\\|m\\(?:acro\\|ethod\\)\\|subst\\|theme\\|un\\|var\\(?:-local\\|alias\\)?\\)\\)\\_>[
\t'(]*\\(\\(?:\\sw\\|\\s_\\)+\\)... [+1]
Mark set
Matches
"(\\(cl-def\\(?:macro\\|s\\(?:\\(?:truc\\|ubs\\)t\\)\\|type\\|un\\)\\|def\\(?:a\\(?:dvice\\|lias\\)\\|c\\(?:lass\\|onst\\|ustom\\)\\|face\\|g\\(?:eneric\\|roup\\)\\|ine-\\(?:derived-mode\\|g\\(?:\\(?:eneric\\|lobal\\(?:\\(?:ized\\)?-minor\\)\\)-mode\\)\\|minor-mode\\|skeleton\\|widget\\)\\|m\\(?:acro\\|ethod\\)\\|subst\\|theme\\|un\\|var\\(?:-local\\|alias\\)?\\)\\)\\_>[
\t'(]*\\(\\(?:\\sw\\|\\s_\\)+\\)... [+1]
Matches
"(\\(cl-def\\(?:macro\\|s\\(?:\\(?:truc\\|ubs\\)t\\)\\|type\\|un\\)\\|def\\(?:a\\(?:dvice\\|lias\\)\\|c\\(?:lass\\|onst\\|ustom\\)\\|face\\|g\\(?:eneric\\|roup\\)\\|ine-\\(?:derived-mode\\|g\\(?:\\(?:eneric\\|lobal\\(?:\\(?:ized\\)?-minor\\)\\)-mode\\)\\|minor-mode\\|skeleton\\|widget\\)\\|m\\(?:acro\\|ethod\\)\\|subst\\|theme\\|un\\|var\\(?:-local\\|alias\\)?\\)\\)\\_>[
\t'(]*\\(\\(?:\\sw\\|\\s_\\)... [+1]
Matches
"(\\(cl-def\\(?:macro\\|s\\(?:\\(?:truc\\|ubs\\)t\\)\\|type\\|un\\)\\|def\\(?:a\\(?:dvice\\|lias\\)\\|c\\(?:lass\\|onst\\|ustom\\)\\|face\\|g\\(?:eneric\\|roup\\)\\|ine-\\(?:derived-mode\\|g\\(?:\\(?:eneric\\|lobal\\(?:\\(?:ized\\)?-minor\\)\\)-mode\\)\\|minor-mode\\|skeleton\\|widget\\)\\|m\\(?:acro\\|ethod\\)\\|subst\\|theme\\|un\\|var\\(?:-local\\|alias\\)?\\)\\)\\_>[
\t'(]*\\(\\(... [-1-]
Matches
"(\\(cl-def\\(?:macro\\|s\\(?:\\(?:truc\\|ubs\\)t\\)\\|type\\|un\\)\\|def\\(?:a\\(?:dvice\\|lias\\)\\|c\\(?:lass\\|onst\\|ustom\\)\\|face\\|g\\(?:eneric\\|roup\\)\\|ine-\\(?:derived-mode\\|g\\(?:\\(?:eneric\\|lobal\\(?:\\(?:ized\\)?-minor\\)\\)-mode\\)\\|minor-mode\\|skeleton\\|widget\\)\\|m\\(?:acro\\|ethod\\)\\|subst\\|theme\\|un\\|var\\(?:-local\\|alias\\)?\\)\\)\\_>[
\t'(]*\\(... [-1-]
Library idna specified by `autoload' does not exist.
Library messagexmas specified by `autoload' does not exist.

Load-path shadows:
/Users/anders/emacs/lisp/table hides
/Volumes/HD2/build/emacs8/trunk/nextstep/Emacs.app/Contents/Resources/lisp/textmodes/table
/Users/anders/emacs/lisp/ruby-mode hides
/Volumes/HD2/build/emacs8/trunk/nextstep/Emacs.app/Contents/Resources/lisp/progmodes/ruby-mode
/Users/anders/emacs/src/asm-mode-new/src/asm-mode hides
/Volumes/HD2/build/emacs8/trunk/nextstep/Emacs.app/Contents/Resources/lisp/progmodes/asm-mode

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail superword
subword image-file eieio-opt speedbar sb-image ezimage dframe face-remap
mb-depth two-column grep icicles-mode icicles-face icicles-cmd2
icicles-cmd1 imenu icicles-mcmd image-dired format-spec icicles-fn
icicles-var icicles-opt ffap cus-theme thingatpt filesets icicles-mac
cus-edit yow shell pcomplete cookie1 bookmark compile autoload tar-mode
lisp-mnt mail-utils parse-time network-stream starttls url-http tls
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw url-cache url-auth
url url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-parse auth-source eieio byte-opt bytecomp
byte-compile cconv eieio-core gnus-util mm-util mail-prsvr
password-cache url-vars mailcap finder-inf package mule-util etags
cperl-mode edebug sgml-mode rdebug-source rdebug-vars gud ruby-mode
font-lock-studio-test ispell cus-start cus-load ctypes end-of-buffer-log
doxygen c-electric-operator c-indent-operator cc-langs ert ewoc faceup
rect vc-bzr find-func debug sh-script smie executable jka-compr info
apropos dired+ dired-x dired-aux pp font-lock-studio derived dired
dabbrev follow misearch multi-isearch vc-dispatcher vc-svn help-mode
eldoc ps-print ps-def lpr server autorevert filenotify folding-isearch
folding view rdebug cwarn prepaint cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs tempo split-nways
lockdir project-name ange-ftp comint ansi-color ring paren mic-paren
cl-macs gv iso-insert minibuf-elfile easy-mmode recentf tree-widget
wid-edit easymenu msb edmacro kmacro disp-table warnings time advice
help-fns cl cl-loaddefs cl-lib time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar 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
minibuffer 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 make-network-process
cocoa ns multi-tty emacs)