bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24389: [PATCH] Support completion of classes and IDs in CSS mode


From: Stefan Monnier
Subject: bug#24389: [PATCH] Support completion of classes and IDs in CSS mode
Date: Sat, 10 Sep 2016 15:55:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>> The definition of those global variables seems to be missing.
>> IIUC they should be in css-mode.el, so their name should start with
>> "css-" I think (tho I agree that it's debatable).
> Hm, is it wrong to let them stay void, and then check whether they're
> bound in each buffer we visit?

What'd be the benefit?  You do want to `defvar' them in order to give
them a doctring (which means that if you want them void you have to do
extra gymnastic), and giving them a good default value means you can
call them without having to check the value beforehand (and that also
means you can use `add-function' on it).

> I ran som benchmarks to assess whether the expensive buffer-hash cache
> is worth it, results follow below.

`buffer-hash` is only a problem in large buffers.  But you can use
buffer-text-modified-tick to get a much quicker test (only important in
large buffers).  And you might not even need to test
buffer-text-modified-tick because you can often just flush the (relevant
part of) the cache(s) from an after-change-functions or from
syntax-propertize or ...

> +      (with-current-buffer buf
> +        (when (boundp extractor)
> +          (funcall (symbol-value extractor)))))

You don't need the boundp test here, AFAICT.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]