GNU bug report logs - #23383
[PATCH] Support completion of color functions in CSS mode

Previous Next

Package: emacs;

Reported by: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>

Date: Tue, 26 Apr 2016 22:50:01 UTC

Severity: wishlist

Tags: patch

Merged with 23384

Done: Simen Heggestøyl <simenheg <at> gmail.com>

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 23383 in the body.
You can then email your comments to 23383 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#23383; Package emacs. (Tue, 26 Apr 2016 22:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 26 Apr 2016 22:50:02 GMT) Full text and rfc822 format available.

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

From: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Support completion of color functions in CSS mode
Date: Tue, 26 Apr 2016 18:48:52 -0400
[Message part 1 (text/plain, inline)]
The attached patch adds completion for CSS color functions such as
`rgb()'. Values were taken from the “CSS Color Module Level 4”. It can
be found at: https://drafts.csswg.org/css-color/#color-type

As a sidenote, how should we handle functions? Since they use
parentheses, the point is going to be outside of parentheses.

Eg.
rgba()*
      ^(point)

Also, should we include the parameters number?
[0001-Add-completion-of-color-functions-in-CSS-mode.patch (text/x-patch, attachment)]

Merged 23383 23384. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 26 Apr 2016 23:55:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 26 Apr 2016 23:55:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23383; Package emacs. (Wed, 27 Apr 2016 19:18:01 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
Cc: 23383 <at> debbugs.gnu.org
Subject: Re: bug#23383: [PATCH] Support completion of color functions in CSS
 mode
Date: Wed, 27 Apr 2016 21:16:58 +0200
[Message part 1 (text/plain, inline)]
Hello Etienne, thanks for the patch.

On Wed, Apr 27, 2016 at 12:48 AM, Etienne Prud'homme 
<e.e.f.prudhomme <at> gmail.com> wrote:
> The attached patch adds completion for CSS color functions such as
> `rgb()'. Values were taken from the “CSS Color Module Level 4”. 
> It can
> be found at: https://drafts.csswg.org/css-color/#color-type

It will be nice to have completion for those new color functions. Some
feedback regarding the patch follows.

- In the completion definitions we've tried to stay as close as possible
 to the structure used in the CSS spec. This means that instead of
 introducing `color-functions' we should make `color' complete directly
 to "rgb()", "rgba()", and so on, then `hex-color', `named-color' and
 the literal `currentcolor' (I think we can skip
 `deprecated-system-color'). `named-color' will then contain the
 literal color names like `color' does now.

- One of the tests in test/lisp/textmodes/css-mode-tests.el needs
 updating. To see this, run `make lisp/textmodes/css-mode-tests' from
 the test directory.

- Please wrap lines around column 70 or so to stay in line with the rest
 of the file.

> As a sidenote, how should we handle functions? Since they use
> parentheses, the point is going to be outside of parentheses.
> 
> Eg.
> rgba()*
>       ^(point)

True, I'm not sure how to best solve it.

> Also, should we include the parameters number?

I think that's rather a job for something like ElDoc (I'm currently
working on adding ElDoc support to CSS mode).

-- Simen
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23383; Package emacs. (Thu, 28 Apr 2016 00:18:02 GMT) Full text and rfc822 format available.

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

From: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: 23383 <at> debbugs.gnu.org
Subject: Re: bug#23383: [PATCH] Support completion of color functions in CSS
 mode
Date: Wed, 27 Apr 2016 20:17:45 -0400
[Message part 1 (text/plain, inline)]
On Wed, 27 Apr 2016 21:16:58 +0200,
Simen Heggestøyl <simenheg <at> gmail.com> wrote:

> - In the completion definitions we've tried to stay as close as
> possible to the structure used in the CSS spec. This means that
> instead of introducing `color-functions' we should make `color'
> complete directly to "rgb()", "rgba()", and so on, then `hex-color',
> `named-color' and the literal `currentcolor' (I think we can skip
>   `deprecated-system-color'). `named-color' will then contain the
>   literal color names like `color' does now.
That’s a good point. Since I saw that `color' lacked most of
them, I wasn’t sure where we were going.

> - One of the tests in test/lisp/textmodes/css-mode-tests.el needs
>   updating. To see this, run `make lisp/textmodes/css-mode-tests' from
>   the test directory.
> 
> - Please wrap lines around column 70 or so to stay in line with the
> rest of the file.
Thanks for reminding me! I completely forgot. Much easier to read.

I’ve made a second patch according to your recommendations. Color
functions are now part of `color' and `named-color' is now a separate
entity. I’ve tried to follow CSSWG ordering, but it’s not always the
same order in the specifications. I also found two more functions not
present earlier.
[0001-Add-completion-of-colors-in-CSS-mode.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23383; Package emacs. (Thu, 28 Apr 2016 17:52:02 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
Cc: 23383 <at> debbugs.gnu.org
Subject: Re: bug#23383: [PATCH] Support completion of color functions in CSS
 mode
Date: Thu, 28 Apr 2016 19:51:37 +0200
[Message part 1 (text/plain, inline)]
Thanks for the revision, Etienne.

There are still a couple of issues that need to be resolved.

- I think we should stick to the current CSS Color Module Level 3
 recommendation [1]. The functions apart from `rgb()', `rgba()',
 `hsl()', and `hsla()' are only present in an Editor's Draft. I find no
 other resources about them, so I don't think we should include them
 until the new spec becomes at least a Candidate Recommendation.

- I think there's little use in completing `#' since it's only one
 character.

- `namedColor' must be changed to `named-color' to match the name of the
 value class.

- The new color names need to be double-checked. For instance I see that
 `limegreen' has become `limeg een' and `salmon' has become `sa mon'.

- The test `css-test-property-values' in
 test/lisp/textmodes/css-mode-tests.el needs a small update.

[1] https://www.w3.org/TR/css3-color/

-- Simen


[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23383; Package emacs. (Fri, 20 May 2016 19:38:02 GMT) Full text and rfc822 format available.

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

From: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: 23383 <at> debbugs.gnu.org
Subject: Re: bug#23383: [PATCH] Support completion of color functions in CSS
 mode
Date: Fri, 20 May 2016 15:37:28 -0400
[Message part 1 (text/plain, inline)]
I've attached the current patch.

> - I think we should stick to the current CSS Color Module Level 3
>   recommendation [1]. The functions apart from `rgb()', `rgba()',
>   `hsl()', and `hsla()' are only present in an Editor's Draft. I find
> no other resources about them, so I don't think we should include them
>   until the new spec becomes at least a Candidate Recommendation.
Thanks. I didn't realize the high probability most of them won't be in
the recommendation

> - I think there's little use in completing `#' since it's only one
>   character.

I was also thinking the same thing. I interpreted: "and so
on, then `hex-color'" too literally.

> - `namedColor' must be changed to `named-color' to match the name of
> the value class.
Thanks for pointing that out.

> - The new color names need to be double-checked. For instance I see
> that `limegreen' has become `limeg een' and `salmon' has become `sa
> mon'.
I made the list with a macro. I was too tired to double check 140
colors. The current list was generated from Dough Crockford's color
list [1] using:

| var list = "";
| for(var i=0, len=colors.length; i<len; i++)
|     list += '"' + colors[i] + '" ';

`colors` needs to be extracted from the Immediately-invoked function
expression [2].

> - The test `css-test-property-values' in
>   test/lisp/textmodes/css-mode-tests.el needs a small update.

I updated the list length to 147 since there's 141
namedColors and 6 values in color. However, I can't make the test
execute since my Git repository is broken and the remote doesn't work
as of now.

Thanks for your patience.

[1] http://www.crockford.com/wrrrld/color.html
[2] https://en.wikipedia.org/wiki/IIFE

Etienne
[0001-Add-completion-of-colors-in-CSS-mode.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23383; Package emacs. (Sat, 21 May 2016 10:43:02 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
Cc: 23383 <at> debbugs.gnu.org
Subject: Re: bug#23383: [PATCH] Support completion of color functions in CSS
 mode
Date: Sat, 21 May 2016 12:42:19 +0200
[Message part 1 (text/plain, inline)]
On Fri, May 20, 2016 at 9:37 PM, Etienne Prud'homme 
<e.e.f.prudhomme <at> gmail.com> wrote:
> I've attached the current patch.

Thank you, Etienne, but it looks like the wrong patch was attached. It
is the same as the one from April.

-- Simen
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23383; Package emacs. (Sat, 21 May 2016 22:44:01 GMT) Full text and rfc822 format available.

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

From: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: 23383 <at> debbugs.gnu.org
Subject: Re: bug#23383: [PATCH] Support completion of color functions in CSS
 mode
Date: Sat, 21 May 2016 18:43:28 -0400
[Message part 1 (text/plain, inline)]
> Thank you, Etienne, but it looks like the wrong patch was attached. It
> is the same as the one from April.

Oops! I've attached the new patch now.

Etienne
[0001-Add-completion-of-colors-in-CSS-mode.patch (text/x-patch, attachment)]

Reply sent to Simen Heggestøyl <simenheg <at> gmail.com>:
You have taken responsibility. (Sun, 22 May 2016 11:04:02 GMT) Full text and rfc822 format available.

Notification sent to Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>:
bug acknowledged by developer. (Sun, 22 May 2016 11:04:02 GMT) Full text and rfc822 format available.

Message #32 received at 23383-done <at> debbugs.gnu.org (full text, mbox):

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Etienne Prud'homme <e.e.f.prudhomme <at> gmail.com>
Cc: 23383-done <at> debbugs.gnu.org
Subject: Re: bug#23383: [PATCH] Support completion of color functions in CSS
 mode
Date: Sun, 22 May 2016 13:03:26 +0200
[Message part 1 (text/plain, inline)]
On Sun, May 22, 2016 at 12:43 AM, Etienne Prud'homme 
<e.e.f.prudhomme <at> gmail.com> wrote:
> Oops! I've attached the new patch now.

Thanks, looks good. Installed in master.

-- Simen
[Message part 2 (text/html, inline)]

Reply sent to Simen Heggestøyl <simenheg <at> gmail.com>:
You have taken responsibility. (Sun, 22 May 2016 11:04:02 GMT) Full text and rfc822 format available.

Notification sent to "Etienne Prud'homme" <yuicopr <at> gmail.com>:
bug acknowledged by developer. (Sun, 22 May 2016 11:04:02 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. (Sun, 19 Jun 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 3 days ago.

Previous Next


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