[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27881: New major mode: Less mode
From: |
Simen Heggestøyl |
Subject: |
bug#27881: New major mode: Less mode |
Date: |
Thu, 03 Aug 2017 19:50:58 +0200 |
On Sun, Jul 30, 2017 at 10:59 PM, Stefan Monnier
<monnier@IRO.UMontreal.CA> wrote:
> See some comments below. One thing, tho: an alternative would be to
put
> it into its own file, which would give it more visibility
Fine by me. Should we perhaps do the same for SCSS mode?
On Mon, Jul 31, 2017 at 8:39 AM, Steve Purcell <steve@sanityinc.com>
wrote:
> +(defconst less-font-lock-keywords
> '(;; Variables
> - ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face)
> + ("@[a-z_-][a-z-_0-9]*" . font-lock-variable-name-face)
> ("&" . font-lock-preprocessor-face)
> ;; Mixins
> - ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1
font-lock-keyword-face)))
> - )
> + ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" .
> + (1 font-lock-keyword-face))))
>
> Is it important to limit those to ASCII chars? If not, then it's
better
> to use [[:alpha:]_-] and [[:alnum:]_-] in the above regexps.
>
>
> Unsure, but it’s likely safe to allow non-ASCII alphanumeric chars.
I'm not sure either, but the Less compiler didn't like some non-ASCII
characters I fed to it, so I suspect it only allows ASCII characters
in variable names.
On Mon, Jul 31, 2017 at 2:44 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> The safety info may need to be autoloaded, indeed (IIUC we have
> a misfeature in there: we should enable the major mode (when
possible)
> before checking safety of the local vars).
I've removed the autoloads from the defcustoms. How does one autoload
safety info?
On Wed, Aug 2, 2017 at 4:16 AM, Tom Tromey <tom@tromey.com> wrote:
> It seems dangerous to me to mark these both as safe. A file could
> specify a dangerous command and then say it's ok to run it on save.
>
> Probably the command should not be :safe.
>
> Maybe the other variables defined after this should also not be safe.
>
> Tom
I think you're right, that seems particularly unsafe to me too. Maybe
`less-css-output-file-name' shouldn't be marked safe either, since it
may specify the name of an important file can get overwritten without
a confirmation.
I've updated the diffs based on your feedback. Thank you all for your
comments so far.
-- Simen
0001-WIP-New-major-mode-Less-CSS-mode.patch
Description: Text Data
0002-WIP-Fixes-and-tweaks-for-the-new-Less-CSS-mode.patch
Description: Text Data