gareth_rees: (Default)
[personal profile] gareth_rees

In ‘Completion annotations’, I illustrated the interactive completion feature in Emacs with a screenshot showing what happens if you type M-x set-cursor-color RET Dark TAB: you get a *Completions* buffer containing the colour names starting with ‘Dark’. Nick Barnes posted a comment pointing out a potential usability improvement:

It would be nice to have a bit more control still, so that (for instance) when completing on colour names one could see the colours.

To do this, just evaluate the following expression:

(dolist (c (defined-colors)) 
 (put-text-property 0 (length c) 'face `(:foreground ,c) c))

and then run any command that prompts you to pick a colour, for example read-color. At this point, if you are used to the way strings work in most programming languages, you ought to be asking yourself, how does this work? )

Profile

gareth_rees: (Default)
gareth_rees

December 2015

S M T W T F S
  12345
6789101112
13 141516171819
20212223242526
2728293031  

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 31st, 2025 02:40 am
Powered by Dreamwidth Studios