From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 06 08:54:27 2016 Received: (at submit) by debbugs.gnu.org; 6 Mar 2016 13:54:27 +0000 Received: from localhost ([127.0.0.1]:36213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1acZ8c-0007ym-Np for submit@debbugs.gnu.org; Sun, 06 Mar 2016 08:54:27 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34317) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1acZ8a-0007yX-SE for submit@debbugs.gnu.org; Sun, 06 Mar 2016 08:54:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acZ8Q-0004Ij-Jh for submit@debbugs.gnu.org; Sun, 06 Mar 2016 08:54:19 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acZ8H-0004I7-Sj for submit@debbugs.gnu.org; Sun, 06 Mar 2016 08:54:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acZ8E-0003rY-1F for bug-gnu-emacs@gnu.org; Sun, 06 Mar 2016 08:54:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acZ88-0004GT-Tk for bug-gnu-emacs@gnu.org; Sun, 06 Mar 2016 08:54:01 -0500 Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:36142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acZ88-0004GK-7t for bug-gnu-emacs@gnu.org; Sun, 06 Mar 2016 08:53:56 -0500 Received: by mail-lb0-x232.google.com with SMTP id x1so105089591lbj.3 for ; Sun, 06 Mar 2016 05:53:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:mime-version; bh=zlybyEN7kz+pdx6gdk62F2qAcSICxtSl9RQgdEP6pOU=; b=MLmjjOLg0VG5to8LVnAePK01xVpI+dtfN8RUdAashwO7wa1kXr/AVlagWTADqhVrai VACMQ7MDaJdxDae7no1wIgS0BOz3sRuoJSZJMpSj4lFyyLWLYHebetQmKLKuZAmedqz5 f5kyJ/qoacTF45eQdt0Ce7uB7nZhk9sjHlyrcf3SPPvA9Eqwop3zUM5abTGyFTbk3tHP IpKxVJbfkBq1qOlVtkBazRs/nrcryE729qiok1bxvn3MwWLHFiW5SNm44VSqlmToZFPE UJpBd3xmzgHRMnBauQwzbMXVPtJzJULRud5SxMVrReJ1pFeMEHX6tOVV0+pg6NEFccj8 AMFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:mime-version; bh=zlybyEN7kz+pdx6gdk62F2qAcSICxtSl9RQgdEP6pOU=; b=AaW0vrvikgsK7B8TxVtWodnH2wN2WMddAmAgzkVKAGToGljpWl9VTlHJ4RXPOVybfr pJN9n1eJhojzM8+fzCmXI0kGz+WETLpmnVbUcNzk86exfW0e1bKerjr2++Pc+NLLFymg Up0/5h2MiCvL6pXS82le1jFwNh2ef1oDMxYJwSkw1bQueLsjSkhwXRDb/wKA6XaJa6Tv jk94RatPPptaYiSE0Ha9qzcUeVVB+dMEBl4kOSiYq/UjVTBE174WmLZJ7e+EzhXmoZib delz/guWkDK0NqL7suuzF1N1hbNWO0R7X6vaPXmro4vTYdHY57SncEp37afl3q60ho7d pG8A== X-Gm-Message-State: AD7BkJJvlPNyEReJdLtjhM6CZI5JBvPZs5dn0EAULXoy5cGaWvQooowy1arVAIEDnf+GSA== X-Received: by 10.112.205.38 with SMTP id ld6mr6362998lbc.55.1457272435156; Sun, 06 Mar 2016 05:53:55 -0800 (PST) Received: from [192.168.100.3] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id mt7sm2025246lbb.25.2016.03.06.05.53.53 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Mar 2016 05:53:54 -0800 (PST) Date: Sun, 06 Mar 2016 14:53:52 +0100 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: [PATCH] Support completion of attribute values in CSS mode To: bug-gnu-emacs@gnu.org Message-Id: <1457272432.10399.0@smtp.gmail.com> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-MjH7JAbJ2vafu/RKj20d" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Stefan Monnier , Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-MjH7JAbJ2vafu/RKj20d Content-Type: multipart/alternative; boundary="=-Sx/2vjC+fcrw7ii2BHPa" --=-Sx/2vjC+fcrw7ii2BHPa Content-Type: text/plain; charset=utf-8; format=flowed Hello! I've finally gotten around to implement property value completion in CSS mode. I've been using the attached patch privately for some weeks now, and it seems to me that it works well. The code has taken much inspiration from company-css.el, but there are some differences: - Completion lists for many new properties have been added, and a few have been removed (most of them from the obsoleted marquee module [1]). - I've manually updated all completion lists according to the CSS spec and fixed some bugs in the existing lists along the way. In general I've tried to stay as close as possible to the grammar described in the CSS spec wrt. names and order of the values and classes. - The new `css--property-values' function is very similar to `company-css-property-values', but it has been updated to support following completion candidates further from the value class completion lists. - Completion a function name will no longer put commas between the parenthesis. My reason for this is that many CSS functions take a variable number of arguments. For instance, the `translate' function is completed by company-css to `translate(,)', but `translate' can take only one argument too, so the completion is misleading. Also, there are functions that support an arbitrary number of arguments. Instead of trying to support this, I've made every function name complete to just `function()'. I think having ElDoc support for CSS functions would be good for making it easier to remember which arguments functions take. - `inherit' has been added as a completion candidate for every property. Please have a look at the patch and tell me what you think! -- Simen [1] https://www.w3.org/TR/css3-marquee/ --=-Sx/2vjC+fcrw7ii2BHPa Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello!

I've finally gotten around to implemen= t property value completion in
CSS mode. I've been using the atta= ched patch privately for some weeks
now, and it seems to me that = it works well.

The code has taken much inspiration= from company-css.el, but there are
some differences:
<= br>
- Completion lists for many new properties have been added, a= nd a few
  have been removed (most of them from the obsolete= d marquee
  module [1]).

- I've man= ually updated all completion lists according to the CSS spec
&nbs= p; and fixed some bugs in the existing lists along the way. In general
  I've tried to stay as close as possible to the grammar describ= ed in
  the CSS spec wrt. names and order of the values and = classes.

- The new `css--property-values' function= is very similar to
  `company-css-property-values', but it = has been updated to support
  following completion candidate= s further from the value class
  completion lists.

- Completion a function name will no longer put commas betw= een the
  parenthesis. My reason for this is that many CSS f= unctions take a
  variable number of arguments. For instance= , the `translate' function
  is completed by company-css to = `translate(,)', but `translate' can
  take only one argument= too, so the completion is misleading. Also,
  there are fun= ctions that support an arbitrary number of
  arguments. Inst= ead of trying to support this, I've made every
  function na= me complete to just `function()'. I think having ElDoc
  sup= port for CSS functions would be good for making it easier to
&nbs= p; remember which arguments functions take.

- `inh= erit' has been added as a completion candidate for every
  p= roperty.

Please have a look at the patch and tell = me what you think!

-- Simen


= --=-Sx/2vjC+fcrw7ii2BHPa-- --=-MjH7JAbJ2vafu/RKj20d Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Support-completion-of-attribute-values-in-CSS-mode.patch >From cff60501026539692491a5f422b7dcb415402b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Sat, 13 Feb 2016 22:18:42 +0100 Subject: [PATCH] Support completion of attribute values in CSS mode * lisp/textmodes/css-mode.el (css-property-alist): New defconst holding CSS identifiers and the values they can have. (css-property-ids): Compute dynamically from `css-property-alist'. (css-value-class-alist): New defconst holding property value classes and their values. (css--property-value-cache): New variable providing a cache for `css--property-values'. (css--property-values): New function for computing a list of possible values for a CSS property. (css--complete-property-value): New function for completing a property value. (css-completion-at-point): Add support for completing property values. --- etc/NEWS | 6 + lisp/textmodes/css-mode.el | 513 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 445 insertions(+), 74 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 92d69d2..d2486da 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -127,6 +127,12 @@ different group ID. --- ** `auto-revert-use-notify' is set back to t in `global-auto-revert-mode'. +** CSS mode + +--- +*** Support for completing attribute values using the `completion-at-point' +command. + * New Modes and Packages in Emacs 25.2 diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 93a8dce..2bb3dd8 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -29,7 +29,6 @@ ;; - electric ; and } ;; - filling code with auto-fill-mode -;; - attribute value completion ;; - fix font-lock errors with multi-line selectors ;;; Code: @@ -74,124 +73,455 @@ css-media-ids "visual") "Identifiers for types of media.") -(defconst css-property-ids - '(;; CSS 2.1 properties (http://www.w3.org/TR/CSS21/propidx.html). - ;; - ;; Properties duplicated by any of the CSS3 modules below have - ;; been removed. - "azimuth" "border-collapse" "border-spacing" "bottom" - "caption-side" "clear" "clip" "content" "counter-increment" - "counter-reset" "cue" "cue-after" "cue-before" "direction" "display" - "elevation" "empty-cells" "float" "height" "left" "line-height" - "list-style" "list-style-image" "list-style-position" - "list-style-type" "margin" "margin-bottom" "margin-left" - "margin-right" "margin-top" "max-height" "max-width" "min-height" - "min-width" "padding" "padding-bottom" "padding-left" - "padding-right" "padding-top" "page-break-after" - "page-break-before" "page-break-inside" "pause" "pause-after" - "pause-before" "pitch" "pitch-range" "play-during" "position" - "quotes" "richness" "right" "speak" "speak-header" "speak-numeral" - "speak-punctuation" "speech-rate" "stress" "table-layout" "top" - "unicode-bidi" "vertical-align" "visibility" "voice-family" "volume" - "width" "z-index" +(defconst css-property-alist + ;; CSS 2.1 properties (http://www.w3.org/TR/CSS21/propidx.html). + ;; + ;; Properties duplicated by any of the CSS3 modules below have been + ;; removed. + '(("azimuth" angle "left-side" "far-left" "left" "center-left" + "center" "center-right" "right" "far-right" "right-side" "behind" + "leftwards" "rightwards") + ("border-collapse" "collapse" "separate") + ("border-spacing" length) + ("bottom" length percentage "auto") + ("caption-side" "top" "bottom") + ("clear" "none" "left" "right" "both") + ("clip" shape "auto") + ("content" "normal" "none" string uri counter "attr()" + "open-quote" "close-quote" "no-open-quote" "no-close-quote") + ("counter-increment" identifier integer "none") + ("counter-reset" identifier integer "none") + ("cue" cue-before cue-after) + ("cue-after" uri "none") + ("cue-before" uri "none") + ("direction" "ltr" "rtl") + ("display" "inline" "block" "list-item" "inline-block" "table" + "inline-table" "table-row-group" "table-header-group" + "table-footer-group" "table-row" "table-column-group" + "table-column" "table-cell" "table-caption" "none" + ;; CSS Flexible Box Layout Module Level 1 + ;; (https://www.w3.org/TR/css3-flexbox/#valdef-display-flex) + "flex" "inline-flex") + ("elevation" angle "below" "level" "above" "higher" "lower") + ("empty-cells" "show" "hide") + ("float" "left" "right" "none") + ("height" length percentage "auto") + ("left" length percentage "auto") + ("line-height" "normal" number length percentage) + ("list-style" list-style-type list-style-position + list-style-image) + ("list-style-image" uri "none") + ("list-style-position" "inside" "outside") + ("list-style-type" "disc" "circle" "square" "decimal" + "decimal-leading-zero" "lower-roman" "upper-roman" "lower-greek" + "lower-latin" "upper-latin" "armenian" "georgian" "lower-alpha" + "upper-alpha" "none") + ("margin" margin-width) + ("margin-bottom" margin-width) + ("margin-left" margin-width) + ("margin-right" margin-width) + ("margin-top" margin-width) + ("max-height" length percentage "none") + ("max-width" length percentage "none") + ("min-height" length percentage) + ("min-width" length percentage) + ("padding" padding-width) + ("padding-bottom" padding-width) + ("padding-left" padding-width) + ("padding-right" padding-width) + ("padding-top" padding-width) + ("page-break-after" "auto" "always" "avoid" "left" "right") + ("page-break-before" "auto" "always" "avoid" "left" "right") + ("page-break-inside" "avoid" "auto") + ("pause" time percentage) + ("pause-after" time percentage) + ("pause-before" time percentage) + ("pitch" frequency "x-low" "low" "medium" "high" "x-high") + ("pitch-range" number) + ("play-during" uri "mix" "repeat" "auto" "none") + ("position" "static" "relative" "absolute" "fixed") + ("quotes" string "none") + ("richness" number) + ("right" length percentage "auto") + ("speak" "normal" "none" "spell-out") + ("speak-header" "once" "always") + ("speak-numeral" "digits" "continuous") + ("speak-punctuation" "code" "none") + ("speech-rate" number "x-slow" "slow" "medium" "fast" "x-fast" + "faster" "slower") + ("stress" number) + ("table-layout" "auto" "fixed") + ("top" length percentage "auto") + ("unicode-bidi" "normal" "embed" "bidi-override") + ("vertical-align" "baseline" "sub" "super" "top" "text-top" + "middle" "bottom" "text-bottom" percentage length) + ("visibility" "visible" "hidden" "collapse") + ("voice-family" specific-voice generic-voice specific-voice + generic-voice) + ("volume" number percentage "silent" "x-soft" "soft" "medium" + "loud" "x-loud") + ("width" length percentage "auto") + ("z-index" "auto" integer) ;; CSS Animations ;; (http://www.w3.org/TR/css3-animations/#property-index) - "animation" "animation-delay" "animation-direction" - "animation-duration" "animation-fill-mode" - "animation-iteration-count" "animation-name" - "animation-play-state" "animation-timing-function" + ("animation" single-animation-name time single-timing-function + single-animation-iteration-count single-animation-direction + single-animation-fill-mode single-animation-play-state) + ("animation-delay" time) + ("animation-direction" single-animation-direction) + ("animation-duration" time) + ("animation-fill-mode" single-animation-fill-mode) + ("animation-iteration-count" single-animation-iteration-count) + ("animation-name" single-animation-name) + ("animation-play-state" single-animation-play-state) + ("animation-timing-function" single-timing-function) ;; CSS Backgrounds and Borders Module Level 3 ;; (http://www.w3.org/TR/css3-background/#property-index) - "background" "background-attachment" "background-clip" - "background-color" "background-image" "background-origin" - "background-position" "background-repeat" "background-size" - "border" "border-bottom" "border-bottom-color" - "border-bottom-left-radius" "border-bottom-right-radius" - "border-bottom-style" "border-bottom-width" "border-color" - "border-image" "border-image-outset" "border-image-repeat" - "border-image-slice" "border-image-source" "border-image-width" - "border-left" "border-left-color" "border-left-style" - "border-left-width" "border-radius" "border-right" - "border-right-color" "border-right-style" "border-right-width" - "border-style" "border-top" "border-top-color" - "border-top-left-radius" "border-top-right-radius" - "border-top-style" "border-top-width" "border-width" "box-shadow" + ("background" bg-layer) + ("background-attachment" attachment) + ("background-clip" box) + ("background-color" color) + ("background-image" bg-image) + ("background-origin" box) + ("background-position" position) + ("background-repeat" repeat-style) + ("background-size" bg-size) + ("border" line-width line-style color) + ("border-bottom" line-width line-style color) + ("border-bottom-color" color) + ("border-bottom-left-radius" length percentage) + ("border-bottom-right-radius" length percentage) + ("border-bottom-style" line-style) + ("border-bottom-width" line-width) + ("border-color" color) + ("border-image" border-image-source border-image-slice + border-image-width border-image-outset border-image-repeat) + ("border-image-outset" length number) + ("border-image-repeat" "stretch" "repeat" "round" "space") + ("border-image-slice" number percentage "fill") + ("border-image-source" "none" image) + ("border-image-width" length percentage number "auto") + ("border-left" line-width line-style color) + ("border-left-color" color) + ("border-left-style" line-style) + ("border-left-width" line-width) + ("border-radius" length percentage "/") + ("border-right" line-width line-style color) + ("border-right-color" color) + ("border-right-style" line-style) + ("border-right-width" line-width) + ("border-style" line-style) + ("border-top" line-width line-style color) + ("border-top-color" color) + ("border-top-left-radius" length percentage) + ("border-top-right-radius" length percentage) + ("border-top-style" line-style) + ("border-top-width" line-width) + ("border-width" line-width) + ("box-shadow" "none" shadow) ;; CSS Basic User Interface Module Level 3 (CSS3 UI) ;; (http://www.w3.org/TR/css3-ui/#property-index) - "box-sizing" "caret-color" "cursor" "nav-down" "nav-left" - "nav-right" "nav-up" "outline" "outline-color" "outline-offset" - "outline-style" "outline-width" "resize" "text-overflow" + ("box-sizing" "content-box" "border-box") + ("caret-color" "auto" color) + ("cursor" uri x y "auto" "default" "none" "context-menu" "help" + "pointer" "progress" "wait" "cell" "crosshair" "text" + "vertical-text" "alias" "copy" "move" "no-drop" "not-allowed" + "grab" "grabbing" "e-resize" "n-resize" "ne-resize" "nw-resize" + "s-resize" "se-resize" "sw-resize" "w-resize" "ew-resize" + "ns-resize" "nesw-resize" "nwse-resize" "col-resize" "row-resize" + "all-scroll" "zoom-in" "zoom-out") + ("nav-down" "auto" id "current" "root" target-name) + ("nav-left" "auto" id "current" "root" target-name) + ("nav-right" "auto" id "current" "root" target-name) + ("nav-up" "auto" id "current" "root" target-name) + ("outline" outline-color outline-style outline-width) + ("outline-color" color "invert") + ("outline-offset" length) + ("outline-style" "auto" border-style) + ("outline-width" border-width) + ("resize" "none" "both" "horizontal" "vertical") + ("text-overflow" "clip" "ellipsis" string) ;; CSS Color Module Level 3 ;; (http://www.w3.org/TR/css3-color/#property) - "color" "opacity" + ("color" color) + ("opacity" alphavalue) ;; CSS Flexible Box Layout Module Level 1 ;; (http://www.w3.org/TR/css-flexbox-1/#property-index) - "align-content" "align-items" "align-self" "flex" "flex-basis" - "flex-direction" "flex-flow" "flex-grow" "flex-shrink" "flex-wrap" - "justify-content" "order" + ("align-content" "flex-start" "flex-end" "center" "space-between" + "space-around" "stretch") + ("align-items" "flex-start" "flex-end" "center" "baseline" + "stretch") + ("align-self" "auto" "flex-start" "flex-end" "center" "baseline" + "stretch") + ("flex" "none" flex-grow flex-shrink flex-basis) + ("flex-basis" "auto" "content" width) + ("flex-direction" "row" "row-reverse" "column" "column-reverse") + ("flex-flow" flex-direction flex-wrap) + ("flex-grow" number) + ("flex-shrink" number) + ("flex-wrap" "nowrap" "wrap" "wrap-reverse") + ("justify-content" "flex-start" "flex-end" "center" + "space-between" "space-around") + ("order" integer) ;; CSS Fonts Module Level 3 ;; (http://www.w3.org/TR/css3-fonts/#property-index) - "font" "font-family" "font-feature-settings" "font-kerning" - "font-language-override" "font-size" "font-size-adjust" - "font-stretch" "font-style" "font-synthesis" "font-variant" - "font-variant-alternates" "font-variant-caps" - "font-variant-east-asian" "font-variant-ligatures" - "font-variant-numeric" "font-variant-position" "font-weight" + ("font" font-style font-variant-css21 font-weight font-stretch + font-size "/" line-height font-family "caption" "icon" "menu" + "message-box" "small-caption" "status-bar") + ("font-family" family-name generic-family) + ("font-feature-settings" "normal" feature-tag-value) + ("font-kerning" "auto" "normal" "none") + ("font-language-override" "normal" string) + ("font-size" absolute-size relative-size length percentage) + ("font-size-adjust" "none" number) + ("font-stretch" "normal" "ultra-condensed" "extra-condensed" + "condensed" "semi-condensed" "semi-expanded" "expanded" + "extra-expanded" "ultra-expanded") + ("font-style" "normal" "italic" "oblique") + ("font-synthesis" "none" "weight" "style") + ("font-variant" "normal" "none" common-lig-values + discretionary-lig-values historical-lig-values + contextual-alt-values "stylistic()" "historical-forms" + "styleset()" "character-variant()" "swash()" "ornaments()" + "annotation()" "small-caps" "all-small-caps" "petite-caps" + "all-petite-caps" "unicase" "titling-caps" numeric-figure-values + numeric-spacing-values numeric-fraction-values "ordinal" + "slashed-zero" east-asian-variant-values east-asian-width-values + "ruby") + ("font-variant-alternates" "normal" "stylistic()" + "historical-forms" "styleset()" "character-variant()" "swash()" + "ornaments()" "annotation()") + ("font-variant-caps" "normal" "small-caps" "all-small-caps" + "petite-caps" "all-petite-caps" "unicase" "titling-caps") + ("font-variant-east-asian" "normal" east-asian-variant-values + east-asian-width-values "ruby") + ("font-variant-ligatures" "normal" "none" common-lig-values + discretionary-lig-values historical-lig-values + contextual-alt-values) + ("font-variant-numeric" "normal" numeric-figure-values + numeric-spacing-values numeric-fraction-values "ordinal" + "slashed-zero") + ("font-variant-position" "normal" "sub" "super") + ("font-weight" "normal" "bold" "bolder" "lighter" "100" "200" + "300" "400" "500" "600" "700" "800" "900") ;; CSS Fragmentation Module Level 3 ;; (https://www.w3.org/TR/css-break-3/#property-index) - "box-decoration-break" "break-after" "break-before" "break-inside" - "orphans" "widows" + ("box-decoration-break" "slice" "clone") + ("break-after" "auto" "avoid" "avoid-page" "page" "left" "right" + "recto" "verso" "avoid-column" "column" "avoid-region" "region") + ("break-before" "auto" "avoid" "avoid-page" "page" "left" "right" + "recto" "verso" "avoid-column" "column" "avoid-region" "region") + ("break-inside" "auto" "avoid" "avoid-page" "avoid-column" + "avoid-region") + ("orphans" integer) + ("widows" integer) ;; CSS Multi-column Layout Module ;; (https://www.w3.org/TR/css3-multicol/#property-index) ;; "break-after", "break-before", and "break-inside" are left out ;; below, because they're already included in CSS Fragmentation ;; Module Level 3. - "column-count" "column-fill" "column-gap" "column-rule" - "column-rule-color" "column-rule-style" "column-rule-width" - "column-span" "column-width" "columns" + ("column-count" integer "auto") + ("column-fill" "auto" "balance") + ("column-gap" length "normal") + ("column-rule" column-rule-width column-rule-style + column-rule-color "transparent") + ("column-rule-color" color) + ("column-rule-style" border-style) + ("column-rule-width" border-width) + ("column-span" "none" "all") + ("column-width" length "auto") + ("columns" column-width column-count) ;; CSS Overflow Module Level 3 ;; (http://www.w3.org/TR/css-overflow-3/#property-index) - "max-lines" "overflow" "overflow-x" "overflow-y" + ("max-lines" "none" integer) + ("overflow" "visible" "hidden" "scroll" "auto" "paged-x" "paged-y" + "paged-x-controls" "paged-y-controls" "fragments") + ("overflow-x" "visible" "hidden" "scroll" "auto" "paged-x" + "paged-y" "paged-x-controls" "paged-y-controls" "fragments") + ("overflow-y" "visible" "hidden" "scroll" "auto" "paged-x" + "paged-y" "paged-x-controls" "paged-y-controls" "fragments") ;; CSS Text Decoration Module Level 3 ;; (http://dev.w3.org/csswg/css-text-decor-3/#property-index) - "text-decoration" "text-decoration-color" "text-decoration-line" - "text-decoration-skip" "text-decoration-style" "text-emphasis" - "text-emphasis-color" "text-emphasis-position" "text-emphasis-style" - "text-shadow" "text-underline-position" + ("text-decoration" text-decoration-line text-decoration-style + text-decoration-color) + ("text-decoration-color" color) + ("text-decoration-line" "none" "underline" "overline" + "line-through" "blink") + ("text-decoration-skip" "none" "objects" "spaces" "ink" "edges" + "box-decoration") + ("text-decoration-style" "solid" "double" "dotted" "dashed" + "wavy") + ("text-emphasis" text-emphasis-style text-emphasis-color) + ("text-emphasis-color" color) + ("text-emphasis-position" "over" "under" "right" "left") + ("text-emphasis-style" "none" "filled" "open" "dot" "circle" + "double-circle" "triangle" "sesame" string) + ("text-shadow" "none" length color) + ("text-underline-position" "auto" "under" "left" "right") ;; CSS Text Module Level 3 ;; (http://www.w3.org/TR/css3-text/#property-index) - "hanging-punctuation" "hyphens" "letter-spacing" "line-break" - "overflow-wrap" "tab-size" "text-align" "text-align-last" - "text-indent" "text-justify" "text-transform" "white-space" - "word-break" "word-spacing" "word-wrap" + ("hanging-punctuation" "none" "first" "force-end" "allow-end" + "last") + ("hyphens" "none" "manual" "auto") + ("letter-spacing" "normal" length) + ("line-break" "auto" "loose" "normal" "strict") + ("overflow-wrap" "normal" "break-word") + ("tab-size" integer length) + ("text-align" "start" "end" "left" "right" "center" "justify" + "match-parent") + ("text-align-last" "auto" "start" "end" "left" "right" "center" + "justify") + ("text-indent" length percentage) + ("text-justify" "auto" "none" "inter-word" "distribute") + ("text-transform" "none" "capitalize" "uppercase" "lowercase" + "full-width") + ("white-space" "normal" "pre" "nowrap" "pre-wrap" "pre-line") + ("word-break" "normal" "keep-all" "break-all") + ("word-spacing" "normal" length percentage) + ("word-wrap" "normal" "break-word") ;; CSS Transforms Module Level 1 ;; (http://www.w3.org/TR/css3-2d-transforms/#property-index) - "backface-visibility" "perspective" "perspective-origin" - "transform" "transform-origin" "transform-style" + ("backface-visibility" "visible" "hidden") + ("perspective" "none" length) + ("perspective-origin" "left" "center" "right" "top" "bottom" + percentage length) + ("transform" "none" transform-list) + ("transform-origin" "left" "center" "right" "top" "bottom" + percentage length) + ("transform-style" "flat" "preserve-3d") ;; CSS Transitions ;; (http://www.w3.org/TR/css3-transitions/#property-index) - "transition" "transition-delay" "transition-duration" - "transition-property" "transition-timing-function" + ("transition" single-transition) + ("transition-delay" time) + ("transition-duration" time) + ("transition-property" "none" single-transition-property "all") + ("transition-timing-function" single-transition-timing-function) ;; Filter Effects Module Level 1 ;; (http://www.w3.org/TR/filter-effects/#property-index) - "color-interpolation-filters" "filter" "flood-color" - "flood-opacity" "lighting-color") + ("color-interpolation-filters" "auto" "sRGB" "linearRGB") + ("filter" "none" filter-function-list) + ("flood-color" color) + ("flood-opacity" number percentage) + ("lighting-color" color)) + "Identifiers for properties and their possible values. +The CAR of each entry is the name of a property, while the CDR is +a list of possible values for that property. A string value +represents a literal value, while a symbol must be looked up in +`css-property-alist' and `css-value-class-alist' to find further +possible values. Some symbols, such as `number' or `identifier', +don't produce any further value candidates, since that list would +be infinite.") + +(defconst css-property-ids + (mapcar #'car css-property-alist) "Identifiers for properties.") +(defconst css-value-class-alist + '(("absolute-size" "xx-small" "x-small" "small" "medium" "large" + "x-large" "xx-large") + ("alphavalue" number) + ("attachment" "scroll" "fixed" "local") + ("bg-image" image "none") + ("bg-layer" bg-image position "/" repeat-style attachment box + background-color) + ("bg-size" length percentage "auto" "cover" "contain") + ("box" "border-box" "padding-box" "content-box") + ("color" "aqua" "black" "blue" "fuchsia" "gray" "green" "lime" + "maroon" "navy" "olive" "orange" "purple" "red" "silver" "teal" + "white" "yellow" "transparent") + ("common-lig-values" "common-ligatures" "no-common-ligatures") + ("contextual-alt-values" "contextual" "no-contextual") + ("counter" "counter()" "counters()") + ("discretionary-lig-values" "discretionary-ligatures" + "no-discretionary-ligatures") + ("east-asian-variant-values" "jis78" "jis83" "jis90" "jis04" + "simplified" "traditional") + ("east-asian-width-values" "full-width" "proportional-width") + ("family-name" "Courier" "Helvetica" "Times") + ("feature-tag-value" string integer "on" "off") + ("filter-function" "blur()" "brightness()" "contrast()" + "drop-shadow()" "grayscale()" "hue-rotate()" "invert()" + "opacity()" "sepia()" "saturate()") + ("filter-function-list" filter-function uri) + ("font-variant-css21" "normal" "small-caps") + ("generic-family" "serif" "sans-serif" "cursive" "fantasy" + "monospace") + ("generic-voice" "male" "female" "child") + ("gradient" linear-gradient radial-gradient + repeating-linear-gradient repeating-radial-gradient) + ("historical-lig-values" "historical-ligatures" + "no-historical-ligatures") + ("image" uri image-list element-reference gradient) + ("image-list" "image()") + ("length" number) + ("line-height" "normal" number length percentage) + ("line-style" "none" "hidden" "dotted" "dashed" "solid" "double" + "groove" "ridge" "inset" "outset") + ("line-width" length "thin" "medium" "thick") + ("linear-gradient" "linear-gradient()") + ("margin-width" "auto" length percentage) + ("numeric-figure-values" "lining-nums" "oldstyle-nums") + ("numeric-fraction-values" "diagonal-fractions" + "stacked-fractions") + ("numeric-spacing-values" "proportional-nums" "tabular-nums") + ("padding-width" length percentage) + ("radial-gradient" "radial-gradient()") + ("relative-size" "larger" "smaller") + ("repeat-style" "repeat-x" "repeat-y" "repeat" "space" "round" + "no-repeat") + ("repeating-linear-gradient" "repeating-linear-gradient()") + ("repeating-radial-gradient" "repeating-radial-gradient()") + ("shadow" "inset" length color) + ("shape" "rect()") + ("single-animation-direction" "normal" "reverse" "alternate" + "alternate-reverse") + ("single-animation-fill-mode" "none" "forwards" "backwards" + "both") + ("single-animation-iteration-count" "infinite" number) + ("single-animation-name" "none" identifier) + ("single-animation-play-state" "running" "paused") + ("single-timing-function" single-transition-timing-function) + ("single-transition" "none" single-transition-property time + single-transition-timing-function) + ("single-transition-property" "all" identifier) + ("single-transition-timing-function" "ease" "linear" "ease-in" + "ease-out" "ease-in-out" "step-start" "step-end" "steps()" + "cubic-bezier()") + ("specific-voice" identifier) + ("target-name" string) + ("transform-list" "matrix()" "translate()" "translateX()" + "translateY()" "scale()" "scaleX()" "scaleY()" "rotate()" + "skew()" "skewX()" "skewY()" "matrix3d()" "translate3d()" + "translateZ()" "scale3d()" "scaleZ()" "rotate3d()" "rotateX()" + "rotateY()" "rotateZ()" "perspective()") + ("uri" "url()") + ("width" length percentage "auto") + ("x" number) + ("y" number)) + "Property value classes and their values. +The format is equal to that of `css-property-alist', except that +the CARs aren't actual CSS properties, but rather a name for a +class of values. + +The following classes have been left out above because they +cannot be completed sensibly: `angle', `element-reference', +`frequency', `id', `identifier', `integer', `number', +`percentage', `string', and `time'.") + (defcustom css-electric-keys '(?\} ?\;) ;; '() "Self inserting keys which should trigger re-indentation." :version "22.2" @@ -410,11 +740,46 @@ css--complete-at-rule (when (eq (char-before) ?\@) (list (point) pos css-at-ids))))) +(defvar css--property-value-cache + (make-hash-table :test 'equal :size (+ (length css-property-alist) + (length css-value-class-alist))) + "Cache of previously completed property values.") + +(defun css--property-values (property) + "Return value completion candidates for PROPERTY." + (or (gethash property css--property-value-cache) + (let (values) + (dolist (value (or (cdr (assoc property css-value-class-alist)) + (cdr (assoc property css-property-alist)))) + (if (stringp value) + (push value values) + (let ((new-values (css--property-values (symbol-name value)))) + (setq values (append values new-values)))) + (puthash property values css--property-value-cache)) + values))) + +(defun css--complete-property-value () + "Complete property value at point." + (let ((property + (save-excursion + (re-search-backward ":[^/]" (line-beginning-position) t) + (let ((property-end (point))) + (skip-chars-backward "-[:alnum:]") + (let ((property (buffer-substring (point) property-end))) + (car (assoc property css-property-alist))))))) + (when property + (let ((end (point))) + (save-excursion + (skip-chars-backward "[:graph:]") + (list (point) end + (cons "inherit" (css--property-values property)))))))) + (defun css-completion-at-point () "Complete current symbol at point. -Currently supports completion of CSS properties, pseudo-elements, -pseudo-classes, and at-rules." +Currently supports completion of CSS properties, property values, +pseudo-elements, pseudo-classes, and at-rules." (or (css--complete-property) + (css--complete-property-value) (css--complete-pseudo-element-or-class) (css--complete-at-rule))) -- 2.7.0 --=-MjH7JAbJ2vafu/RKj20d-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 06 14:10:47 2016 Received: (at 22923) by debbugs.gnu.org; 6 Mar 2016 19:10:47 +0000 Received: from localhost ([127.0.0.1]:37026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ace4l-00078y-3G for submit@debbugs.gnu.org; Sun, 06 Mar 2016 14:10:47 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37567) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1ace4i-00078j-Sz for 22923@debbugs.gnu.org; Sun, 06 Mar 2016 14:10:45 -0500 Received: by mail-wm0-f53.google.com with SMTP id p65so47658019wmp.0 for <22923@debbugs.gnu.org>; Sun, 06 Mar 2016 11:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=ELCHH99fzJ4L8Zm70c9NWljn14XD6Nm8cTZZ9iFjREs=; b=sObvXXQnIQeN/NJHpWbuaXZarBPnfuXveUqC16tZONVjVR1Hj2E9zVL4S3PnrPhCgt BEcAiY+w/wLT2u8OK82UpQ08KxLHFiih+ObgT3EVpOFFlne0j/DSxjZFpEFgTCjbcCwS li1pmuDeGiOdqPE/R1v5YqSS+5A5keoWxnG21A2WrEUiFBPUdX4wFIaZtArUY8lr3A8J 0ChXMzgezBaLxXCLULLj7CCY2VmMYpTe7n4rYl4XSDgbSzUccBENvyC0LQVC7uHe3+2c DMYnjyyPg52VM39pXUHaTdrbNJGAc/CiNjvKk1rc/woQx27aKbVbHO45gEIGXVhv+gb+ 6pFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ELCHH99fzJ4L8Zm70c9NWljn14XD6Nm8cTZZ9iFjREs=; b=XES+0SzNIRsx2HS1IXiZt1bE16r0QGkXz90LL/e2eu9Mnyyx3huOf59BJQfoP0UWo8 oKQdodsgIG6XIKdYNxIK7rzCtwR9BOIFMuaA//QofAPFkJZwXOkkLOpy5k8DXdzVslYu UzwHSXMiCcCMXBn4Ih/wkhVWliHsFjozpJjIyJcAUKHJKBheHgYndte+phD+Uyv+wd5t jBJvYaCV6aGz6j5H6AF9NSO6wujy9vkVbn/zzIiGCkJrrTZSGXKPKTG8J9YqsnVTK1iN MXldhID5jj3dm3Eq0LbadldDOht5ljI8vsuD9PF57o9y5zZkpPOUmiHujvNTB1q7rDvZ gTTA== X-Gm-Message-State: AD7BkJKYE05lW7wP7K4j94LPve2RySSortzfpOk6kEX5Nnm64+85j7DI3kwrv3dcAmTi6Q== X-Received: by 10.194.22.97 with SMTP id c1mr19090564wjf.19.1457291439274; Sun, 06 Mar 2016 11:10:39 -0800 (PST) Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id ks5sm14271881wjb.13.2016.03.06.11.10.37 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Mar 2016 11:10:38 -0800 (PST) Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: =?UTF-8?Q?Simen_Heggest=c3=b8yl?= , 22923@debbugs.gnu.org References: <1457272432.10399.0@smtp.gmail.com> From: Dmitry Gutov Message-ID: Date: Sun, 6 Mar 2016 21:10:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1457272432.10399.0@smtp.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 22923 Cc: Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Hi Simen, On 03/06/2016 03:53 PM, Simen Heggestøyl wrote: > I've finally gotten around to implement property value completion in > CSS mode. I've been using the attached patch privately for some weeks > now, and it seems to me that it works well. I haven't tried it, but it looks good overall. > - The new `css--property-values' function is very similar to > `company-css-property-values', but it has been updated to support > following completion candidates further from the value class > completion lists. Doesn't the latter allow for several indirections? It seems to me the two functions are equivalent. One question: is there a reason to do the (symbol-name value) conversion before doing the css--property-values lookup? Maybe the css-value-class-alist should have symbol keys, not strings. > - Completion a function name will no longer put commas between the > parenthesis. My reason for this is that many CSS functions take a > variable number of arguments. For instance, the `translate' function > is completed by company-css to `translate(,)', but `translate' can > take only one argument too, so the completion is misleading. Also, > there are functions that support an arbitrary number of > arguments. Instead of trying to support this, I've made every > function name complete to just `function()'. I think having ElDoc > support for CSS functions would be good for making it easier to > remember which arguments functions take. Sounds good. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 09 14:02:04 2016 Received: (at 22923) by debbugs.gnu.org; 9 Mar 2016 19:02:04 +0000 Received: from localhost ([127.0.0.1]:41811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adjMy-0006wC-KN for submit@debbugs.gnu.org; Wed, 09 Mar 2016 14:02:04 -0500 Received: from mail-lb0-f169.google.com ([209.85.217.169]:34345) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adjMw-0006vh-1w for 22923@debbugs.gnu.org; Wed, 09 Mar 2016 14:02:02 -0500 Received: by mail-lb0-f169.google.com with SMTP id xr8so76035589lbb.1 for <22923@debbugs.gnu.org>; Wed, 09 Mar 2016 11:02:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:in-reply-to:references :mime-version; bh=zX/Dynx19KGV9A5QWzHcxVzYo+qwTHADE4zUEdQrIA4=; b=Y0+gzFkWhrPh4ScfHB8g7dYUdRUzIDq2AWUMOIOAcJJKnDrUIL87KgncBTvxEcgegi YOB17IgRiah6FcH3QsNda1w/mLZ6bUcfNYtlFU6k+qnY98jEHBE1780UESA0XMJoOhnz 8wM/zBj4ED06IFC357+YrmhM0AOosAwwVF5g37QfDC19EgaklaHCNBobfoQWwB/LIKLo eAV9Kznw5ISyvF5iut15CSxG6EN0JyijLJmL9GTh5kZ1HsNrOLQs9HUGs4ZbCA3NZJDJ 5fchBRqoDMuaiFxgV8iOUqYubagsfr8bTEuNq9aPxsh5vwEfzzSOqrpp7XPFKKjXj6sG s/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:in-reply-to :references:mime-version; bh=zX/Dynx19KGV9A5QWzHcxVzYo+qwTHADE4zUEdQrIA4=; b=DKESrvW+JT3sTmf2LLLsIk/RxQDr/yJNgyfIy042jTd9Ps85f60F3esoB6Mnaf3Jb6 hWI9AxEF2l+zA9Rhig5Wve8o/yyktFeTDDVCBgjo8UDZzzGzl9ohBZ+RbEXUF3CCymnH /1xsUmgG8R75bLY9oFNvEr7tl8XluKthfinUtrtqe5AvPtTKdvUapakc1YMX+qTRGLuU Ezl+TszYpGs1IyGnohrfWYf4uSehg0dmMtbyKrjEHtwfsdS3ahEjre3MlfN5ngFAFBaL VVsIzleUILlTgWhn9yyrCShjxSbmSX3g0lNBHZfSvhvDjafJCoiUGtlqhAKkPQNLURzG ouxA== X-Gm-Message-State: AD7BkJJ+Y/ZsHLdvTKh+UIp9N9JDnaK8YY+zA6TBmbtBAL03C1COHvD3Uo8J0gxqMckz+w== X-Received: by 10.112.51.8 with SMTP id g8mr9174700lbo.109.1457550114917; Wed, 09 Mar 2016 11:01:54 -0800 (PST) Received: from [192.168.100.3] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id qn2sm1462287lbb.49.2016.03.09.11.01.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Mar 2016 11:01:54 -0800 (PST) Date: Wed, 09 Mar 2016 20:01:52 +0100 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: Dmitry Gutov Message-Id: <1457550112.3805.2@smtp.gmail.com> In-Reply-To: References: <1457272432.10399.0@smtp.gmail.com> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-TR35Q37bD0DEXXqJ7hc6" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22923 Cc: 22923@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-TR35Q37bD0DEXXqJ7hc6 Content-Type: text/plain; charset=utf-8; format=flowed Hi Dmitry, thanks for your review. On Sun, Mar 6, 2016 at 8:10 PM, Dmitry Gutov wrote: > Doesn't the latter allow for several indirections? It seems to me the > two functions are equivalent. It does, sorry for being unclear. I'll try to reformulate it: There are two lists that must be traversed to find completion candidates: the property alist and the value class alist. company-css.el supports indirections from the property alist into itself, and into the value class alist. With this patch, indirection can happen from the property alist into itself and into the value class alist, but also from the value class alist into itself and back into the property alist. > One question: is there a reason to do the (symbol-name value) > conversion before doing the css--property-values lookup? > > Maybe the css-value-class-alist should have symbol keys, not strings. With the change mentioned above, the property alist and the value class alist are now treated like the same kind of data structure by `css--property-values'. The only difference is that the CARs of the entries in the property alist are also valid property names. So I thought it simpler if the keys were of the same data type. I don't have an opinion on whether that should be string or symbol, just that they are the same. Did this answer your question? -- Simen --=-TR35Q37bD0DEXXqJ7hc6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Dmitry, thanks for your review.

On Sun, Mar 6, 2016 at 8:10 = PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
Doesn't the la= tter allow for several indirections? It seems to me the two functions are e= quivalent.

It does, sorry for be= ing unclear. I'll try to reformulate it:

There are= two lists that must be traversed to find completion
candidates: = the property alist and the value class alist. company-css.el
supp= orts indirections from the property alist into itself, and into the
value class alist. With this patch, indirection can happen from the
property alist into itself and into the value class alist, but also f= rom
the value class alist into itself and back into the property = alist.

One question: is there a reason to do the (s= ymbol-name value) conversion before doing the css--property-values lookup? Maybe the css-value-class-alist should have symbol keys, not strings.
=

With the change mentioned above, the prope= rty alist and the value class
alist are now treated like the= same kind of data structure by
`css--property-values'. The only = difference is that the CARs of the
entries in the property alist = are also valid property names. So I
thought it simpler if the key= s were of the same data type. I don't have
an opinion on whether = that should be string or symbol, just that they
are the same.

Did this answer your question?

-- Simen
= --=-TR35Q37bD0DEXXqJ7hc6-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 20:25:51 2016 Received: (at 22923) by debbugs.gnu.org; 11 Mar 2016 01:25:51 +0000 Received: from localhost ([127.0.0.1]:44180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeBpv-0001kL-9Z for submit@debbugs.gnu.org; Thu, 10 Mar 2016 20:25:51 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:33430) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeBpt-0001k9-8O for 22923@debbugs.gnu.org; Thu, 10 Mar 2016 20:25:49 -0500 Received: by mail-wm0-f53.google.com with SMTP id l68so9902100wml.0 for <22923@debbugs.gnu.org>; Thu, 10 Mar 2016 17:25:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=CyVbXGB0GlOGqzyxnf9oiMXC6Lp0vPmYkQvBPO889LY=; b=CT1z4lHvnqr5AytLZ0hpSHDaKg9rnIx0Unq4GJaD77Z6/pCpoJYv21JTcvk+fOxHji g1VuPYRMSlIh4DgDeqmjGPQmEkAJvlnisAEF5LkpS+2mW4nntBBuLXRJ2J7A3pb8oRot 6PVJa5NbOZ4+ac6jC3nGPa7v8ZuW/zulFLNlv9gW5rwNRhLJRPnP2tI4TXDRT5nrnZtX 5dXXPxyW46EI4o+gVb1Co76w9q/5uPj2uLLm/u7QO2GKsxXpoSFVy8d+KHHvY7RVGkPF DiFBkRZ9WzWy92XH9/3YVehTYhmL14fpj809sUZ0tClBMjrj9O450bXoFSpWp0AXNcfn ubag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=CyVbXGB0GlOGqzyxnf9oiMXC6Lp0vPmYkQvBPO889LY=; b=SEh/PO3MGwJgdVx2lXlQIMGtwqha3ZN/cE7rkRbqFBwqq/2qZ8U0oseConf2wM03H2 ORSJ1b1vg2Lw4JkVd1qIsfQ66+B/4gzi+yA5vGg3TMyzRf58E+JlNLa8NJsRn8leZY0O MVFrrOJZGxt1fpdzat8SfWNTFYUnWS0c9NwYNbGMHkPW29r3+/MI+tRwZb7L2R0Haysy XhQqYzDj6jq36TMqkbnkkVyjb40DcrmSly1uc9TOJ7C+RDM4sIDBNySJdw1kXvvieGKt JCf5vp3jJECD/vOs1Macejv1g906Pmr7bj2JdVmj3b9BgB3ULpaNJ4GgorsWdufeSLRA 1vYA== X-Gm-Message-State: AD7BkJI1jf4Y4lUX0iH8dK8l3dDJm0thWwlSU9tgEXbcQaWW+qzdNTuZKbFSTk8baLIRWw== X-Received: by 10.28.182.194 with SMTP id g185mr260697wmf.41.1457659543591; Thu, 10 Mar 2016 17:25:43 -0800 (PST) Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id bg1sm6049243wjc.27.2016.03.10.17.25.42 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 10 Mar 2016 17:25:42 -0800 (PST) Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: =?UTF-8?Q?Simen_Heggest=c3=b8yl?= References: <1457272432.10399.0@smtp.gmail.com> <1457550112.3805.2@smtp.gmail.com> From: Dmitry Gutov Message-ID: <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> Date: Fri, 11 Mar 2016 03:25:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1457550112.3805.2@smtp.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 22923 Cc: 22923@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 03/09/2016 09:01 PM, Simen Heggestøyl wrote: > There are two lists that must be traversed to find completion > candidates: the property alist and the value class alist. company-css.el > supports indirections from the property alist into itself, and into the > value class alist. With this patch, indirection can happen from the > property alist into itself and into the value class alist, but also from > the value class alist into itself and back into the property alist. I see. Is there anything in particular this approach is buying us? Any properties that company-css doesn't support now, and would be suboptimal using its current approach? IMHO, having the indirection go only one way is better organization, and it's easier to understand when reading the code. > With the change mentioned above, the property alist and the value class > alist are now treated like the same kind of data structure by > `css--property-values'. The only difference is that the CARs of the > entries in the property alist are also valid property names. So I > thought it simpler if the keys were of the same data type. I don't have > an opinion on whether that should be string or symbol, just that they > are the same. > > Did this answer your question? Yes, thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 19 08:42:28 2016 Received: (at 22923) by debbugs.gnu.org; 19 Mar 2016 12:42:28 +0000 Received: from localhost ([127.0.0.1]:53248 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahGD6-00027e-E0 for submit@debbugs.gnu.org; Sat, 19 Mar 2016 08:42:28 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahGD4-00027R-IQ for 22923@debbugs.gnu.org; Sat, 19 Mar 2016 08:42:27 -0400 Received: by mail-lf0-f53.google.com with SMTP id d82so35684377lfe.3 for <22923@debbugs.gnu.org>; Sat, 19 Mar 2016 05:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:in-reply-to:references :mime-version; bh=YGxxsg+X8fcaB4c633RKebi9L6RMq1WKbdS6pgmvVow=; b=CzoQ9DlZjmF3g3a0YbzCY90iF+O1dPuUuAOlG6ZdXHQPu1MFKcnlc1P/pMxQgEGLCo serFtAygtHHykzBTwrpUdP3w16CJPF87KM/S+DCbZrGxPPsV5RxJJIWD2DQWIJZRH65W naB+28MZMAPFF3XX9bsu4P0nUi8ZII1oO1BOApvBaKbhrxEXa0VsB1ebLCS3E0Pjmxse PbQW5L19zEQGlLgnfND2XmYPqa80TJ6Z5Wuzk1SBvNRHdugS68+CpLtPa2abpFjUVR5k q2HK9P8R4rus+NuvDzLFOyHAJNdqwr1fqzqPv8On9mk90jLwkdvULQG/6anKW9Mh6n5Q jLnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:in-reply-to :references:mime-version; bh=YGxxsg+X8fcaB4c633RKebi9L6RMq1WKbdS6pgmvVow=; b=XxHxGQcY0BFi8TwDIhxHIE2eSx/FycrzMTJQmZ6G7COoE2ApKjN3WEpmw+3bwwmn4X bIvHm+pzkgeO0BP8nb3HhNZyrWapzq4WENzvpbU1xcTqW7mfoGokwa6ZBTwlPaTt4K/U W35pS4+BAObEVkjQsCUJEIYH8VfOns76fkPGnbNWT+Q50VdvMnUBJapZW0N9UgLOMiow c+pwYvi0PF4DpF32VTInxfsP29DPLTv4TbI7YkZK+ucQLpLMb2rqURel/sGhqKlcyJKK sTt19KRzkVxqdCUbCTUe5dwtqOKGJ/VKNKPsLjk+0n77H3Siw1Umi2EBTEUnuGDY+b8v BT4A== X-Gm-Message-State: AD7BkJL6TY5Nu9cM8+8+1jr0oWqD76QVPCZYumUsWx4TprZTv1XByVbsP3MNaVIPokjwJA== X-Received: by 10.25.137.215 with SMTP id l206mr6202155lfd.140.1458391340519; Sat, 19 Mar 2016 05:42:20 -0700 (PDT) Received: from [192.168.100.5] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id qh4sm1075702lbb.43.2016.03.19.05.42.19 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 19 Mar 2016 05:42:19 -0700 (PDT) Date: Sat, 19 Mar 2016 13:42:18 +0100 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: Dmitry Gutov Message-Id: <1458391338.13455.0@smtp.gmail.com> In-Reply-To: <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> References: <1457272432.10399.0@smtp.gmail.com> <1457550112.3805.2@smtp.gmail.com> <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-Yw6zKLuxNkghXKT2oz6J" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22923 Cc: 22923@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-Yw6zKLuxNkghXKT2oz6J Content-Type: text/plain; charset=utf-8; format=flowed Hello again, Dmitry, and sorry for the late response. On Fri, Mar 11, 2016 at 2:25 AM, Dmitry Gutov wrote: > I see. Is there anything in particular this approach is buying us? > Any properties that company-css doesn't support now, and would be > suboptimal using its current approach? Yes, it allows us to stay close to the CSS spec, which is my view is very valuable when maintaining these lists. Here is a concrete example: the value class `image' is defined as follows in the CSS Image Values spec [1]: = | | | Which translates naturally to: ("image" uri image-list element-reference gradient) It is not a CSS property, so it should go into the value class alist. It is referenced by the `border-image-source' property as well as the `bg-image' value class (which in turn is referenced by the `background-image' property and `bg-layer' value class). My point is that even though it would be possible to eliminate the need for this value class by expanding it where it is referenced, I think that by keeping it, it'll be much easier to make updates to it when the CSS spec changes. I think it is worth the added complexity. -- Simen [1] https://www.w3.org/TR/css3-images/ --=-Yw6zKLuxNkghXKT2oz6J Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello again, Dmitry, and sorry for the late response.

On Fri, M= ar 11, 2016 at 2:25 AM, Dmitry Gutov <dgutov@yandex.ru> wrote:
I see. Is there anything in particular this approach is buying us? An= y properties that company-css doesn't support now, and would be suboptimal = using its current approach?

Yes, it a= llows us to stay close to the CSS spec, which is my view is
very = valuable when maintaining these lists.

Here is a c= oncrete example: the value class `image' is defined as
follows in= the CSS Image Values spec [1]:

  <image&g= t; =3D <url> | <image-list> | <element-reference> | <g= radient>

Which translates naturally to:

  ("image" uri image-list element-reference gradient= )

It is not a CSS property, so it should go into t= he value class alist. It
is referenced by the `border-image-sourc= e' property as well as the
`bg-image' value class (which in turn = is referenced by the
`background-image' property and `bg-layer' v= alue class).

My point is that even though it would= be possible to eliminate the need
for this value class by expand= ing it where it is referenced, I think
that by keeping it, it'll = be much easier to make updates to it when the
CSS spec changes. I= think it is worth the added complexity.

= --=-Yw6zKLuxNkghXKT2oz6J-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 19 21:17:21 2016 Received: (at 22923) by debbugs.gnu.org; 20 Mar 2016 01:17:21 +0000 Received: from localhost ([127.0.0.1]:54031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahRzd-0001IX-DM for submit@debbugs.gnu.org; Sat, 19 Mar 2016 21:17:21 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:38527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahRzb-0001IK-P9 for 22923@debbugs.gnu.org; Sat, 19 Mar 2016 21:17:20 -0400 Received: by mail-wm0-f43.google.com with SMTP id l68so82378179wml.1 for <22923@debbugs.gnu.org>; Sat, 19 Mar 2016 18:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=AhDzcqntYPhwucB8FcbCsZmgQLt+cZIOJEFpfK1wPkQ=; b=ta62uVLubxROMFX+9dF30hzVeowVR87K2ZcxjpGsl8BG4vGXp6D9f+vt+HsohSXSt3 vuo0HLljSfRKHUgq/hHHXCcSec1FBw5VB0xU52A2CKBVgtzoDgr9qe3zZ7CDFvkLDHuE FnsZFHI9klZCMzCfa7WxaNGwR1sDHQvdO3592WjbZqYksbDtceWytmL1kkEppEK2z1/D LSIVubBeLJopvf+H//625xTAJihYepz6SA9R5ERxra2jUbU7gF79/WY8gen17RnGUWQk lwYIF04M7J2wetj7UKDaGUX7Ekkuwji9pPehgXIqZ7i+dn2jqRcU2hU3jjrgQ3mKvsC9 8rbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=AhDzcqntYPhwucB8FcbCsZmgQLt+cZIOJEFpfK1wPkQ=; b=VEV8x/aCBZFBEonGHtfwvNsY1Kf6YHC45S+1lE6bkD43V5Q4LE6w6X9KEN9EAjh+/i C62ioe4bOvCgwn16wRr2lXbJOxQgDqFIqyihklJu3SpONLz0jxbPNlIDTftclJnb3/h4 IBFdYrUhgZsE9u62BC811u+ztUsoFDWxWRhy3FTax0XNyp4F0p5OOWNF8oIC+m1rlbFa NZBpYUfeckDzLh9Le3v2zkAvaxvu/sPGT7gzZx+hVxO8y/wmCaVYMCm9XH8q76CClE+t q3n3U3p3p1RgRTbx6A2cCGtv5fXm31Kc/xRnq5QZy2/W/NWtpdv8Kduk2E5Lk38gxdC2 hlWQ== X-Gm-Message-State: AD7BkJJpEk/pMCmgKK+O8bJvCjt/qnuluv9nMwzmO0iLrAeOaBN/f1ztQo21dcRyfIwcqw== X-Received: by 10.28.128.83 with SMTP id b80mr6476446wmd.6.1458436634268; Sat, 19 Mar 2016 18:17:14 -0700 (PDT) Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id c144sm5757171wmd.12.2016.03.19.18.17.13 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 19 Mar 2016 18:17:13 -0700 (PDT) Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: =?UTF-8?Q?Simen_Heggest=c3=b8yl?= References: <1457272432.10399.0@smtp.gmail.com> <1457550112.3805.2@smtp.gmail.com> <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> <1458391338.13455.0@smtp.gmail.com> From: Dmitry Gutov Message-ID: Date: Sun, 20 Mar 2016 03:17:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1458391338.13455.0@smtp.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 22923 Cc: 22923@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Hi again, Simen, On 03/19/2016 02:42 PM, Simen Heggestøyl wrote: > Yes, it allows us to stay close to the CSS spec, which is my view is > very valuable when maintaining these lists. Sure, but by "current approach" I meant what Company does. Please clarify: > Here is a concrete example: the value class `image' is defined as > follows in the CSS Image Values spec [1]: > > = | | | > > Which translates naturally to: > > ("image" uri image-list element-reference gradient) > > It is not a CSS property, so it should go into the value class alist. It > is referenced by the `border-image-source' property as well as the > `bg-image' value class (which in turn is referenced by the > `background-image' property and `bg-layer' value class). If you were adding it to company-css, wouldn't you just add it to company-css-value-classes? And then refer to it in background-image value inside company-css-property-alist? What the limitation of that approach? Do value classes in the spec refer back to the actual properties sometimes? > My point is that even though it would be possible to eliminate the need > for this value class by expanding it where it is referenced, I think > that by keeping it, it'll be much easier to make updates to it when the > CSS spec changes. I think it is worth the added complexity. I'm not sure I follow. Expanding it in company-css-property-alist? From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 21 05:14:19 2016 Received: (at 22923) by debbugs.gnu.org; 21 Mar 2016 09:14:19 +0000 Received: from localhost ([127.0.0.1]:56210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahvuk-0003dr-Rp for submit@debbugs.gnu.org; Mon, 21 Mar 2016 05:14:19 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:34305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahvuj-0003df-CU for 22923@debbugs.gnu.org; Mon, 21 Mar 2016 05:14:17 -0400 Received: by mail-wm0-f50.google.com with SMTP id p65so143127332wmp.1 for <22923@debbugs.gnu.org>; Mon, 21 Mar 2016 02:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:in-reply-to:references :mime-version; bh=90PpPY4oL8MZhm8S1XUz8eikcjds9gkYqRrJnnOLke4=; b=DCoQFF8Bwun8PncI+umwA+IhSwGvQa0+n8nj3W+XkP19IEfyu/EJlRkAH+nS2qWMbL K6bvgJdnzjN3AILHPW1K9fhT15lQDfk2gVzDNE8mZ9ebK0Nxo2KCblLW7QeVKnEg6S3c DQn3RO5ICqpUyF2wmScoDHvXQsU0ylniXCHEO7ufvdVXIHBFQ453PAqGynbMk2pvzBEG Oj4VYbRZhSyQ3sIxMwuPVqa33iwn1oGyQaldEwT2f/p+D4jgBHNoxq2ZW3DN5WHPCNnQ azcQ8TF+7n2giQvQY8uzpjO58F9OMWY00nxLQe1/Fc/1EvjovmR2I+WEpCqM2l0xFGm4 Li3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:in-reply-to :references:mime-version; bh=90PpPY4oL8MZhm8S1XUz8eikcjds9gkYqRrJnnOLke4=; b=g0yx59koF2GkJOkSQsVZdPJhw4hFJDg64FhIv6FQmrLSXXH30Nv7s9XcmFkZwCF4iT sg6HkexK7HY8IEL1BSwpzSXaAXR4XKD3LwI9nGmdMawOn5MQWysfN7GZWX+DE13a0gj4 KLg2teR3AZr6+t//mbi2c61gkXbuom9Z5QEBfFeDg2A/ngNgJhWKTwWE1U03WQXTmGh2 pFH6BQA4VLm22FMWDxzaO9cL07k/Jx4oaP0DDTYtuHXlyI+Zf71ITbvWFDLfNHPJoCOx MduukjNx0y/Qw6DqxIJNUjIH732UpLdLzAkwx1y2ovhb8NrcNQeID1TtYC75nMpyC3w5 VDRg== X-Gm-Message-State: AD7BkJIozRkVFB/RbMrTsmTuNHAse8Moh3gMowxgS/NonzbbdUUwS1j36/oLn6q2+sXHvA== X-Received: by 10.194.190.6 with SMTP id gm6mr29748999wjc.115.1458551651724; Mon, 21 Mar 2016 02:14:11 -0700 (PDT) Received: from [192.168.101.25] ([77.40.215.202]) by smtp.gmail.com with ESMTPSA id i5sm24275917wja.23.2016.03.21.02.14.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Mar 2016 02:14:11 -0700 (PDT) Date: Mon, 21 Mar 2016 10:14:09 +0100 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: Dmitry Gutov Message-Id: <1458551649.2272.0@smtp.gmail.com> In-Reply-To: References: <1457272432.10399.0@smtp.gmail.com> <1457550112.3805.2@smtp.gmail.com> <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> <1458391338.13455.0@smtp.gmail.com> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-mFXhC6fzPLhCXpNuUK89" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22923 Cc: 22923@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-mFXhC6fzPLhCXpNuUK89 Content-Type: text/plain; charset=utf-8; format=flowed On Sun, Mar 20, 2016 at 2:17 AM, Dmitry Gutov wrote: > If you were adding it to company-css, wouldn't you just add it to > company-css-value-classes? And then refer to it in background-image > value inside company-css-property-alist? > > What the limitation of that approach? Do value classes in the spec > refer back to the actual properties sometimes? Yes, though on closer inspection, I see that it only happens in one case so far (the value class `bg-layer' referring to the property `background-color'). But more importantly, in the example above, the `image' value class refers to four other value classes, one of which has further references. This case is not handled by the current company-css, since it only recurses on values from the property alist. This is the main difference between `company-css-property-values' and `css--property-values': the former doesn't support referencing from the value class alist. (Indeed, there seems to be a bug in `company-css-value-classes' where `align-stretch' tries to refer to `align-common', but that won't work.) > I'm not sure I follow. Expanding it in company-css-property-alist? I meant that if we wanted to keep the value class alist flat, i.e. don't put references in it, we could replace every entry with the result of `(company-css-property-values "value-class-name")'. -- Simen --=-mFXhC6fzPLhCXpNuUK89 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, Mar 20, 2016 at 2:17 AM, Dmitry Gutov <dgutov@yandex.ru> wrot= e:
If you were adding it to company-css, wouldn't you just add = it to company-css-value-classes? And then refer to it in background-image v= alue inside company-css-property-alist? What the limitation of that approach? Do value classes in the spec refer ba= ck to the actual properties sometimes?

Yes, though on closer inspection, I see that it only happens in one case<= /div>
so far (the value class `bg-layer' referring to the property
`background-color').

But more importantly, i= n the example above, the `image' value class
refers to four other= value classes, one of which has further references.
This case is= not handled by the current company-css, since it only
recurses o= n values from the property alist.

This is the main= difference between `company-css-property-values' and
`css--prope= rty-values': the former doesn't support referencing from the
valu= e class alist.

(Indeed, there seems to be a bug in= `company-css-value-classes' where
`align-stretch' tries to refer= to `align-common', but that won't work.)

I'm not sure I = follow. Expanding it in company-css-property-alist?

<= div>
I meant that if we wanted to keep the value class alist flat, i.e.= don't
put references in it, we could replace every entry with th= e result of
`(company-css-property-values "value-class-name")'.

-- Simen
= --=-mFXhC6fzPLhCXpNuUK89-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 21 07:03:00 2016 Received: (at 22923) by debbugs.gnu.org; 21 Mar 2016 11:03:00 +0000 Received: from localhost ([127.0.0.1]:56261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahxbw-0007rW-Bc for submit@debbugs.gnu.org; Mon, 21 Mar 2016 07:03:00 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35859) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahxbv-0007rK-Mt for 22923@debbugs.gnu.org; Mon, 21 Mar 2016 07:03:00 -0400 Received: by mail-wm0-f51.google.com with SMTP id r129so45240619wmr.1 for <22923@debbugs.gnu.org>; Mon, 21 Mar 2016 04:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=snPzRJqqXMQKcSz6rIYU/kvL0fFV9YoQvUXVcBu7uFk=; b=GXDEqN14Ke7sOHcPMATuVqTnFyZ2hCii3+RJI5aaLretHHN3M9Uf31+2UXelbEHkVY MPg4Qd2lVReVMdwIX8p5en6oeLrmHprz7AKt6iHuuQKRqTdLi55HC6yJIVdQQXhyVXPP IDiDCJijxzPxkEHPJ9b7EI4mUT3fJ/GcmTNIy3NIrnXSb/z1jQcFpjNmh0Yk1kziqcjO cpHLbhkUXQvYSsmQZ+pCeZtwbCLjYwDDgc/NEe+cgm+GfQL0D+7AFLwACO+z3lmnrxtA 5khs7No7m4W+EHmxbjor2kW3m8fqytxj1kkcTpsuYGQgIayhyTmXE7nTogdBaW1qUbj4 4OnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=snPzRJqqXMQKcSz6rIYU/kvL0fFV9YoQvUXVcBu7uFk=; b=g7e+uZiNDK0TJ/AjVoKXLAlH43ssE3qJQZIgwPcoBOn0KZ4WvZPOpBeRVSzJI/CXgX ZFV4LOghiWGDaI/6GBcKr3cXDGUKODHLeDzAHh5KiCqA4SrgqvZOPI4MySiGhkWMtKsR IF00RrRJWiUHCJqN+Kftx6GSDrLydf/cvNbC9DXLHAy8fI9OzmEwdkyp1nF9VkxiV+O3 GwvajqDeAYs6WztyuVlijGtEpGklm1GbPEzoY9UvCWmNOtuSZpR0/7BNt1ygZdMXj/yF jvDcKJRyWqPNG6OM7+2MUCd7t0RwOokGtgZVgz+jjRjtlQN7SwYYl5j6wahBCHQae3WI /oew== X-Gm-Message-State: AD7BkJLaI5CPr2fG3Y/PLtb62JqgbDHHkdznqPyltKaWpZ8k9VftS9suEAow9rJD7mvkrw== X-Received: by 10.194.71.70 with SMTP id s6mr29351557wju.1.1458558173790; Mon, 21 Mar 2016 04:02:53 -0700 (PDT) Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id a10sm24753285wjb.38.2016.03.21.04.02.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Mar 2016 04:02:52 -0700 (PDT) Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: =?UTF-8?Q?Simen_Heggest=c3=b8yl?= References: <1457272432.10399.0@smtp.gmail.com> <1457550112.3805.2@smtp.gmail.com> <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> <1458391338.13455.0@smtp.gmail.com> <1458551649.2272.0@smtp.gmail.com> From: Dmitry Gutov Message-ID: <7d30e9bd-b376-f1ba-527a-268a8e4d0fce@yandex.ru> Date: Mon, 21 Mar 2016 13:02:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1458551649.2272.0@smtp.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 22923 Cc: 22923@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 03/21/2016 11:14 AM, Simen Heggestøyl wrote: > Yes, though on closer inspection, I see that it only happens in one case > so far (the value class `bg-layer' referring to the property > `background-color'). It seems like you could replace that reference with `color'. > But more importantly, in the example above, the `image' value class > refers to four other value classes, one of which has further references. > This case is not handled by the current company-css, since it only > recurses on values from the property alist. > > This is the main difference between `company-css-property-values' and > `css--property-values': the former doesn't support referencing from the > value class alist. > > (Indeed, there seems to be a bug in `company-css-value-classes' where > `align-stretch' tries to refer to `align-common', but that won't work.) You're right, it's a bug. I'd fix that with only making company-css-value-classes recursive (but not refer back to company-css-property-alist there). To put it differently, I don't like that there's conflation of property values and property names: if there appears a value sometimes that is the same as some property's name (unlikely, I know), it would be hard to represent in the proposed structure. Anyway, I've taken more than enough of your time. Please go ahead with whichever version you prefer. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 23 14:18:06 2016 Received: (at 22923-done) by debbugs.gnu.org; 23 Mar 2016 18:18:06 +0000 Received: from localhost ([127.0.0.1]:34708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ainM6-0007xd-J0 for submit@debbugs.gnu.org; Wed, 23 Mar 2016 14:18:06 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:33204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ainM4-0007x3-Hd for 22923-done@debbugs.gnu.org; Wed, 23 Mar 2016 14:18:04 -0400 Received: by mail-lf0-f51.google.com with SMTP id o73so17717716lfe.0 for <22923-done@debbugs.gnu.org>; Wed, 23 Mar 2016 11:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:in-reply-to:references :mime-version; bh=xVD5OOmtuewu6Dfqxp9HtFnIaLDhrOG1p/AfwCFN0BE=; b=OuVY5MLi8ku+qUUDvXtsbRoTGxjVDG/j5J/ayzGjQ8T96J5/N4hDQGRIeFuquGBXIL uTEB8u5VflW1fRy15/ijZpuA/YIL1L85q1gKndxmmLGhFjCzDJ6PzOJ+p4v64w+VwxQE 5QrkhmE3pVGaVFXwW3zQEHWhBwWHQrIPT2ygs6SYMydDKf0dVJ4TaIG017g958z31evy WllNmgjC4T3DzMJwleFt/kieTNxodW1a3p2SI1/8XLChfGm8D+P5/KOJ9/5XrdCyKSXT d94iOIahsVgiWaegUOWM1ji+ImIaL4cggQutaM2qaRQ3CHTxvHc7NpFhw/q1gI6SE+6Y rnqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:in-reply-to :references:mime-version; bh=xVD5OOmtuewu6Dfqxp9HtFnIaLDhrOG1p/AfwCFN0BE=; b=i0OR+ZU1eUevS8s9aB9T1APeNL1RJ3o6wJSIbhwVuuYjG1/P579SIOoSkZEirvywd6 UWePBJnalA2s/iDCmk166aJBDHlIDlkABINrx3nsGq150EW3Zb+g0SAM01n7ANEef396 szm8W60IPeVduDpUf0pSK0jEsm8sSXgwCED3HY1AlXo+ixj0h6RGX6Y0SSbj628UofOq 4vIWo3RtTRxyXTmrfbx5nqWvsamhBv9nWdQ0DN2uz46M1NXT7V7xxugf7o85dyYcjgFy 5PtiyDL6FcLqsjbCwrk2u5j9rTbeEr5QzoCXfP71ZeJSSCyluKbU6RAzC4lvWT0uFKs1 1PPw== X-Gm-Message-State: AD7BkJKVjG2VYC3kx1F4qBhU/IzLe5uqvAJuZRQbCYDRaMKRFKbMLE+uSVim2Z5zgR36tw== X-Received: by 10.25.28.140 with SMTP id c134mr1460378lfc.99.1458757078682; Wed, 23 Mar 2016 11:17:58 -0700 (PDT) Received: from [192.168.100.5] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id jb5sm579711lbc.8.2016.03.23.11.17.57 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Mar 2016 11:17:58 -0700 (PDT) Date: Wed, 23 Mar 2016 19:17:56 +0100 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: Dmitry Gutov Message-Id: <1458757076.18872.0@smtp.gmail.com> In-Reply-To: <7d30e9bd-b376-f1ba-527a-268a8e4d0fce@yandex.ru> References: <1457272432.10399.0@smtp.gmail.com> <1457550112.3805.2@smtp.gmail.com> <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> <1458391338.13455.0@smtp.gmail.com> <1458551649.2272.0@smtp.gmail.com> <7d30e9bd-b376-f1ba-527a-268a8e4d0fce@yandex.ru> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-SyJq81tDZfZJdiLBHqsV" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22923-done Cc: 22923-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-SyJq81tDZfZJdiLBHqsV Content-Type: text/plain; charset=utf-8; format=flowed On Mon, Mar 21, 2016 at 12:02 PM, Dmitry Gutov wrote: > You're right, it's a bug. I'd fix that with only making > company-css-value-classes recursive (but not refer back to > company-css-property-alist there). > > To put it differently, I don't like that there's conflation of > property values and property names: if there appears a value > sometimes that is the same as some property's name (unlikely, I > know), it would be hard to represent in the proposed structure. > > Anyway, I've taken more than enough of your time. Please go ahead > with whichever version you prefer. Don't worry Dmitry, I very much appreciate your through reviews. You are right that there are some cases where property names and value class names are the same (there are currently four), and I found a bug in my handling of one of those. I remedied that by going with your suggestion of making value classes symbols again, and only referring to other value classes from those. For properties, I made them also refer to value classes by default, but made it possible to refer back to other properties in the cases where the reference isn't found in the value class alist. I attempted to document this thoroughly in the code and added some tests that should cover the tricky cases. I've installed the patch with the changes mentioned above. Thanks again! -- Simen --=-SyJq81tDZfZJdiLBHqsV Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Mar 21, 2016 at 12:02 PM, Dmitry Gutov <dgutov@yandex.ru> wro= te:
You're right, it's a bug. I'd fix that with only making com= pany-css-value-classes recursive (but not refer back to company-css-propert= y-alist there). To put it differently, I don't like that there's conflation of property val= ues and property names: if there appears a value sometimes that is the same= as some property's name (unlikely, I know), it would be hard to represent = in the proposed structure. Anyway, I've taken more than enough of your time. Please go ahead with whic= hever version you prefer.

Don't worry Dmitr= y, I very much appreciate your through reviews.

Yo= u are right that there are some cases where property names and value
<= div>class names are the same (there are currently four), and I found a bug<= /div>
in my handling of one of those. I remedied that by going with you= r
suggestion of making value classes symbols again, and only refe= rring to
other value classes from those.

For properties, I made them also refer to value classes by default, but
made it possible to refer back to other properties in the cases whe= re
the reference isn't found in the value class alist.
=
I attempted to document this thoroughly in the code and adde= d some tests
that should cover the tricky cases.

I've installed the patch with the changes mentioned above.

Thanks again!

-- Sime= n
= --=-SyJq81tDZfZJdiLBHqsV-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 23 19:08:27 2016 Received: (at 22923) by debbugs.gnu.org; 23 Mar 2016 23:08:27 +0000 Received: from localhost ([127.0.0.1]:34886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1airt5-00051L-Gg for submit@debbugs.gnu.org; Wed, 23 Mar 2016 19:08:27 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:33765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1airt3-000514-U3 for 22923@debbugs.gnu.org; Wed, 23 Mar 2016 19:08:26 -0400 Received: by mail-wm0-f43.google.com with SMTP id l68so252733095wml.0 for <22923@debbugs.gnu.org>; Wed, 23 Mar 2016 16:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=9Qd6FZoss6wF2dZwl+5kV54hEitHYd5pndl2CIRC628=; b=W5ftVMZX73RX0uYlesZF20A2aCNrtOQBYOntN2w5MsrEwIMT4gZFDGEMq7jxMI4UMv fzYMGRkEi9rr0U/5AXONpSHlFklnR03Nmymk54WL1WhC41LLryzJjHYG30Sjt6OOE3YC joC0WgJC1PJQMs4p6Y2sGhiFFyJmS6zfXhCDvJWvpPnoNTIQfGiujdtLm8zSya1BH68o DxwKGBYNZdybK2I02TVAHAunoVVbcSk0CTQKjJll25rzhgYBwHT3s+mrmNqxSSaxs+B9 cz9sKh2h4nPXaHIdYPy66oIKE+vrb3YN48dvaOsFoeFilm+SJL0IKAkCkjxB3xetpdpg RouQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=9Qd6FZoss6wF2dZwl+5kV54hEitHYd5pndl2CIRC628=; b=VVBXQwM+kdVOGdyujOcTf6FC0yTlTnAO/HEi1WG3HiBTYOjQp/+fzp6jAxLg8uQrge QyTvQUXRrFuB++XEpwanwKLNriY45qy7sZ/7hAc8VbN/TlNGAjK5Kcf8CFRi0bkimJd/ Mq6C5Oa9cDu7dKS5q1SJo0XWQSQAu3fza7kUhybqDHI9Q2Htn+w92TnwXQb7mDVAaRn9 WfBPmTBGnD8gDRoVJ3WT7Y9GMQhwS66QNWpXJAVjGtb+LRAQmf5/K2agCGT2501DXXqU u7VR6a89NrA6aIv8b02EMcn4rOipiEKKWU/K4c5k7baP6VCYfuMcJZHtR5QB3cElxe3e XZrw== X-Gm-Message-State: AD7BkJI23jB6TRnUbn0VGuezpIgNFOH5AimAg7I7SBLEJD50DssMOMUT9vZ+NFILJi3d+w== X-Received: by 10.194.113.38 with SMTP id iv6mr6014075wjb.126.1458774500240; Wed, 23 Mar 2016 16:08:20 -0700 (PDT) Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id a1sm4636584wje.43.2016.03.23.16.08.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Mar 2016 16:08:19 -0700 (PDT) Subject: Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode To: 22923@debbugs.gnu.org, simenheg@gmail.com References: <1457272432.10399.0@smtp.gmail.com> <1457550112.3805.2@smtp.gmail.com> <0400ddb1-6995-eb93-2dde-c7d5a5a992b0@yandex.ru> <1458391338.13455.0@smtp.gmail.com> <1458551649.2272.0@smtp.gmail.com> <7d30e9bd-b376-f1ba-527a-268a8e4d0fce@yandex.ru> <1458757076.18872.0@smtp.gmail.com> From: Dmitry Gutov Message-ID: <093e0045-6477-2d3b-e142-8c8d30cf2fff@yandex.ru> Date: Thu, 24 Mar 2016 01:08:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1458757076.18872.0@smtp.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 22923 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 03/23/2016 08:17 PM, Simen Heggestøyl wrote: > You are right that there are some cases where property names and value > class names are the same (there are currently four), and I found a bug > in my handling of one of those. I remedied that by going with your > suggestion of making value classes symbols again, and only referring to > other value classes from those. > > For properties, I made them also refer to value classes by default, but > made it possible to refer back to other properties in the cases where > the reference isn't found in the value class alist. > > I attempted to document this thoroughly in the code and added some tests > that should cover the tricky cases. > > I've installed the patch with the changes mentioned above. Great! Thanks, Simen. From unknown Mon Aug 18 19:33:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 21 Apr 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator