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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12761 in the body.
You can then email your comments to 12761 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Mon, 29 Oct 2012 08:02:01 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: cl-lib.el functions do not get font-locked like cl.el ones
Date: Mon, 29 Oct 2012 03:58:58 -0400
Package: emacs
Version: 24.2.50
Severity: minor

In current trunk:

emacs -Q -l cl

(letf ...)
(cl-letf ...)

`letf' gets font-lock-keyword-face, `cl-letf' does not get fontified.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Mon, 29 Oct 2012 13:57:01 GMT) Full text and rfc822 format available.

Message #6 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 12761 <at> debbugs.gnu.org
Subject: Re: bug#12761: cl-lib.el functions do not get font-locked like cl.el
	ones
Date: Mon, 29 Oct 2012 09:53:47 -0400
> `letf' gets font-lock-keyword-face, `cl-letf' does not get fontified.

I'm not sure which of the two is a bug, to tell you the truth.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Tue, 30 Oct 2012 07:41:02 GMT) Full text and rfc822 format available.

Message #9 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12761 <at> debbugs.gnu.org
Subject: Re: bug#12761: cl-lib.el functions do not get font-locked like cl.el
	ones
Date: Tue, 30 Oct 2012 03:37:56 -0400
Stefan Monnier wrote:

>> `letf' gets font-lock-keyword-face, `cl-letf' does not get fontified.
>
> I'm not sure which of the two is a bug, to tell you the truth.

I guess the bug was ever font-locking things from cl.el that are not in
Common Lisp. So maybe that special treatment (lexical-let, letf, etc)
should be removed, to make everyone equally miserable.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Tue, 30 Oct 2012 13:36:02 GMT) Full text and rfc822 format available.

Message #12 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 12761 <at> debbugs.gnu.org
Subject: Re: bug#12761: cl-lib.el functions do not get font-locked like cl.el
	ones
Date: Tue, 30 Oct 2012 09:33:16 -0400
>>> `letf' gets font-lock-keyword-face, `cl-letf' does not get fontified.
>> I'm not sure which of the two is a bug, to tell you the truth.
> I guess the bug was ever font-locking things from cl.el that are not in
> Common Lisp.

And to the extent that cl.el's "namespace uncleanliness" was enough to
ostracize it, font-locking the elements which are in Common-Lisp (but
not in core Elisp) was also a mistake.

> 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--"?).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Sat, 15 Dec 2012 16:56:02 GMT) Full text and rfc822 format available.

Message #15 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Schmidt <christopher <at> ch.ristopher.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 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




Forcibly Merged 12761 15007. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 02 Aug 2013 16:42:02 GMT) Full text and rfc822 format available.

Disconnected #15007 from all other report(s). Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 02 Aug 2013 16:43:02 GMT) Full text and rfc822 format available.

Forcibly Merged 12761 15009. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 02 Aug 2013 16:43:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Fri, 02 Aug 2013 17:06:01 GMT) Full text and rfc822 format available.

Message #24 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 12761 <at> debbugs.gnu.org
Subject: Re: bug#15009: cl-lib symbols in lisp-font-lock-keywords
Date: Fri, 2 Aug 2013 19:05:09 +0200
> Dupe of http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12761

Oops, sorry.

Anyway, I see there was mild consensus but then things stalled.
Christopher Schmidt's add-cl-font-lock-keywords is a good start but it
just font-locks the keyword, not the name for cl-defun, etc.

We should go forward with some fix, because there are currently ~90
uses of cl-defstruct/cl-defun in the lisp sources, and the number will
likely go up.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Tue, 13 Aug 2013 23:00:05 GMT) Full text and rfc822 format available.

Message #27 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: 12761 <at> debbugs.gnu.org
Subject: bug #12761 - please do it
Date: Tue, 13 Aug 2013 15:59:22 -0700 (PDT)
Whatever way you choose to implement it, please do font-lock
`cl-*' and `*' Common-Lisp stuff - at least all of the defining
forms (e.g., `cl-defstruct').  This should have been done as part
of the task of adding such things to Emacs.

Please also font-lock (and add to Imenu) `gv-define-setter' &
compagnie.

ALL defining forms that are part of distributed Emacs source
code should be font-locked by default.  Users should not have
to do anything to get this highlighting.

(They could conceivably be given a means to turn font-locking
off for some defining forms, but that is not something that I
would propose.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Wed, 14 Aug 2013 00:45:01 GMT) Full text and rfc822 format available.

Message #30 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 12761 <at> debbugs.gnu.org
Subject: Re: bug#12761: bug #12761 - please do it
Date: Tue, 13 Aug 2013 20:44:37 -0400
> Please also font-lock (and add to Imenu) `gv-define-setter' &
> compagnie.

Actually, gv setters and expanders should normally be added via
(declare (gv-setter ...)) or (declare (gv-expander ...)), so they don't
need any special handling in Imenu or font-lock.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Wed, 14 Aug 2013 01:50:02 GMT) Full text and rfc822 format available.

Message #33 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12761 <at> debbugs.gnu.org
Subject: RE: bug#12761: bug #12761 - please do it
Date: Tue, 13 Aug 2013 18:49:20 -0700 (PDT)
> > Please also font-lock (and add to Imenu) `gv-define-setter' &
> > compagnie.
> 
> Actually, gv setters and expanders should normally be added via
> (declare (gv-setter ...)) or (declare (gv-expander ...)), so they don't
> need any special handling in Imenu or font-lock.

Good to hear. But I don't see that, not yet at least. Not in this build:

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-08-07 on ODIEONE
Bzr revision: 113750 lekktu <at> gmail.com-20130808011911-0jzpc9xuncegg6x9
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 CFLAGS=-O0 -g3 LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'

Visit frameset.el and search for `(gv-define-setter frameset-prop'.
Do you see `gv-define-setter' highlighted?  Do you see its first arg
highlighted?

The name of its first arg is in Imenu as a function, but perhaps that
is only because there is also a `(defun frameset-prop)'.

Personally, I care more about the font-locking, FWIW.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Wed, 14 Aug 2013 02:34:02 GMT) Full text and rfc822 format available.

Message #36 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 12761 <at> debbugs.gnu.org
Subject: Re: bug#12761: bug #12761 - please do it
Date: Tue, 13 Aug 2013 22:33:09 -0400
>> > Please also font-lock (and add to Imenu) `gv-define-setter' &
>> > compagnie.
>> 
>> Actually, gv setters and expanders should normally be added via
>> (declare (gv-setter ...)) or (declare (gv-expander ...)), so they don't
>> need any special handling in Imenu or font-lock.

> Good to hear. But I don't see that, not yet at least. Not in this build:
[...]
> Visit frameset.el and search for `(gv-define-setter frameset-prop'.
> Do you see `gv-define-setter' highlighted?  Do you see its first arg
> highlighted?

You misread me.  I'm saying that frameset.el should not call
gv-define-setter and should instead use (declare (gv-setter ...)).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Wed, 14 Aug 2013 02:38:02 GMT) Full text and rfc822 format available.

Message #39 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12761 <at> debbugs.gnu.org
Subject: RE: bug#12761: bug #12761 - please do it
Date: Tue, 13 Aug 2013 19:36:50 -0700 (PDT)
> >> > Please also font-lock (and add to Imenu) `gv-define-setter' &
> >> > compagnie.
> >>
> >> Actually, gv setters and expanders should normally be added via
> >> (declare (gv-setter ...)) or (declare (gv-expander ...)), so they don't
> >> need any special handling in Imenu or font-lock.
> 
> > Good to hear. But I don't see that, not yet at least. Not in this build:
> [...]
> > Visit frameset.el and search for `(gv-define-setter frameset-prop'.
> > Do you see `gv-define-setter' highlighted?  Do you see its first arg
> > highlighted?
> 
> You misread me.  I'm saying that frameset.el should not call
> gv-define-setter and should instead use (declare (gv-setter ...)).

I see.  Yes, I misunderstood.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12761; Package emacs. (Wed, 14 Aug 2013 12:31:02 GMT) Full text and rfc822 format available.

Message #42 received at 12761 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12761 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#12761: bug #12761 - please do it
Date: Wed, 14 Aug 2013 14:29:23 +0200
On Wed, Aug 14, 2013 at 4:33 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:

> You misread me.  I'm saying that frameset.el should not call
> gv-define-setter and should instead use (declare (gv-setter ...)).

I have that already in my local copy of frameset.el (which includes a
few other changes that I want to push to the repo).

But I have refrained of pushing that specific change because (declare
(gv-*...)) isn't documented. I just filed a bug report about that.

   J




bug marked as fixed in version 24.4, send any further explanations to 12761 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 08 Oct 2013 17:32:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 Nov 2013 12:24:03 GMT) Full text and rfc822 format available.

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.