GNU bug report logs - #27881
New major mode: Less mode

Previous Next

Package: emacs;

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

Date: Sun, 30 Jul 2017 17:54:01 UTC

Severity: wishlist

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Tom Tromey <tom <at> tromey.com>
Cc: steve <at> sanityinc.com, 27881 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca,
 dgutov <at> yandex.ru
Subject: Re: bug#27881: New major mode: Less mode
Date: Thu, 03 Aug 2017 19:50:58 +0200
[Message part 1 (text/plain, inline)]
On Sun, Jul 30, 2017 at 10:59 PM, Stefan Monnier 
<monnier <at> 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 <at> 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 <at> 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 <at> 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 (text/x-patch, attachment)]
[0002-WIP-Fixes-and-tweaks-for-the-new-Less-CSS-mode.patch (text/x-patch, attachment)]

This bug report was last modified 7 years and 285 days ago.

Previous Next


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