GNU bug report logs - #12761
cl-lib.el functions do not get font-locked like cl.el ones

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Mon, 29 Oct 2012 08:02:01 UTC

Severity: minor

Merged with 15009

Found in versions 24.2.50, 24.3.50

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Christopher Schmidt <christopher <at> ch.ristopher.com>
To: 12761 <at> debbugs.gnu.org
Subject: bug#12761: cl-lib.el functions do not get font-locked like cl.el ones
Date: Sat, 15 Dec 2012 16:54:24 +0000 (GMT)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> So maybe that special treatment (lexical-let, letf, etc)
>> should be removed, to make everyone equally miserable.
>
> Right.  But then the "cl-*" versions could be fine choices (tho I'd
> much rather not hard code those things in the font-lock rules.
> Couldn't we build those dynamically by loading cl-lib.el, then going
> through the obarray, keeping all macros whose name starts with "cl-"
> but not "cl--"?).

+1.

I think it might be a good idea to remove CL font lock support in
emacs-lisp-mode and its deviates by default.  A function that adds
keyword highlighting on the fly could be added, though.

    (require 'cl-lib)

    (defun add-cl-font-lock-keywords ()
      (font-lock-add-keywords
       'emacs-lisp-mode
       (eval-when-compile
         (cl-loop
          for s being the symbols
          for n = (symbol-name s)
          when (and (string-match-p "^cl-[^-]" n)
                    (condition-case nil
                        (eq (car (symbol-function s)) 'macro)
                      (error)))
          collect (list (concat "(\\(?:[ \t]*\\)\\<\\("
                                (regexp-quote n)
                                "\\)\\>")
                        1
                        font-lock-keyword-face)
          end))))

An user just needs to put (add-cl-font-lock-keywords) in his init.el in
case he really wants CL font lock support.

I am just brainstorming here.  This does not take care of
lisp-interaction-mode, *scratch*, etc.

        Christopher




This bug report was last modified 11 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.