color-identifiers-mode icon indicating copy to clipboard operation
color-identifiers-mode copied to clipboard

color-identifiers won't take affect automatically.

Open c02y opened this issue 10 years ago • 3 comments
trafficstars

I put this in my init.el:

(add-hook 'after-init-hook 'global-color-identifiers-mode)

Restart my Emacs, open a C file, the color-identifiers-mode is already enabled(in mode-line), but the font-face doesn't change.

If I M-x color-identifiers:refresh once or M-x color-identifiers-mode twice (first to disable it then enable), the face will change.

Update:

Actually, after more than 5 seconds the face finally changes.

c02y avatar Jan 16 '15 09:01 c02y

any thoughts here?

11111000000 avatar Mar 10 '17 05:03 11111000000

Actually, after more than 5 seconds the face finally changes.

There's a timeout before recoloring. It's done because Emacs doesn't support multi-threading (I hope may be these guys gonna solve it), and recoloring in the main thread on every little change would result in lags.

It's in seconds, the line

            (run-with-idle-timer 5 t 'color-identifiers:refresh)))

I changed the 5 to 2 locally. I don't have time ATM, but you might want to make a PR with making it a global variable and modifying the README.

Hi-Angel avatar Oct 04 '17 06:10 Hi-Angel

Emacs 26 supports cooperative multithreading.

innerout avatar Jul 21 '18 18:07 innerout

So, what you want is achieved with changing a color-identifiers:timer variable to run immediately. E.g.:

  (setq-default color-identifiers:timer (run-with-idle-timer 0 t 'color-identifiers:refresh))

Sans documenting that in README.md Idk what else can be done here.

Hi-Angel avatar Jan 09 '23 05:01 Hi-Angel

Oh, yeah, ability to do that should work since this commit (I'm referring it in a PR even though it's merged, because it was accidentally squashed with another commit on merge).

Hi-Angel avatar Jan 09 '23 05:01 Hi-Angel

Will be fixed by https://github.com/ankurdave/color-identifiers-mode/pull/87

After this PR is merged, you can add to your config a (setq color-identifiers:recoloring-delay 0) to make the recoloring take effect immediately.

Hi-Angel avatar Jan 09 '23 05:01 Hi-Angel

I should note though that setting it to 0 may (or may not) slow down the mode, depending on how Emacs generates events to changes in buffer. I also think that newer Emacs versions are better in that regard. Anyway, I think that's a separate problem that deserves its own bugreport. As far as making the recoloring effect apply the change immediately, the PR adds an option for that (or the code snippet in this comment if you don't have the PR).

Hi-Angel avatar Jan 09 '23 05:01 Hi-Angel

FTR: I opened a discussion to decrease the delay as well to reduce possible confusion https://github.com/ankurdave/color-identifiers-mode/pull/89

Hi-Angel avatar Jan 09 '23 19:01 Hi-Angel