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

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 04 Feb 2014 17:39:04 +0000

Your bug report

#16620: 24.3.50; fontification in the definition of ert tests names does not highlight full symbol

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
16620: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16620
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#16620: 24.3.50; Font-lock rule for `ert' does not handle words with dashes (fix included)
From: Stefan Monnier <[email-masked]>
To: Anders Lindgren <[email-masked]>
Cc: [email-masked]
Date: Tue, 04 Feb 2014 12:37:37 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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.

Thanks, installed,

        Stefan

Subject: 24.3.50; fontification in the definition of ert tests names does not highlight full symbol
From: Nicolas Richard <[email-masked]>
To: [email-masked]
Date: Fri, 17 Jan 2014 10:43:09 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

Running: 
emacs -Q -l ert testfile.el

with the following content of testfile.el:
(ert-deftest latex-movement ...)
(defun latex-movement ...)

will highlight only 'latex' in the first line, instead of the whole
symbol 'latex-movement'. Second line is just there to check that it
works for defun.

Here's a fix:

diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 4b11860..ee058a8 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1469,7 +1469,7 @@ the tests)."
   "Activate font-lock keywords for some of ERT's symbols."
   (font-lock-add-keywords
    nil
-   '(("(\\(\\<ert-deftest\\)\\>\\s *\\(\\sw+\\)?"
+   '(("(\\(\\<ert-deftest\\)\\>\\s *\\(\\(?:\\sw\\|\\s_\\)+\\)?"
       (1 font-lock-keyword-face nil t)
       (2 font-lock-function-name-face nil t)))))

-- 
Nico.