1

I want to modify the region's foreground regardless of syntax highlighting.

(set-face-attribute 'region nil :foreground "#656555")

But this is what I get (see sample):

enter image description here

C-u C-x = gives:

             position: 483 of 1807 (27%), column: 0
            character: ( (displayed as () (codepoint 40, #o50, #x28)
    preferred charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x28
               script: latin
               syntax: ()   which means: open, matches )
             category: .:Base, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #x28
            file code: #x28 (encoded by coding system prefer-utf-8-unix)
              display: by this font (glyph code)
    mac-ct:-*-Monaco-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x0B)

Character code properties: customize what to show
  name: LEFT PARENTHESIS
  old-name: OPENING PARENTHESIS
  general-category: Ps (Punctuation, Open)
  decomposition: (40) ('(')

There is an overlay here:
 From 483 to 623
  face                 region
  priority             (nil . 100)
  window               #<window 3 on init-theme.el>


There are text properties here:
  fontified            t
  • Is #656555 equal to zenburn/fg-1? – lawlist Jan 28 '15 at 2:02
  • Yes, sorry unclear. – Mathieu Marques Jan 28 '15 at 2:02
  • Have you tried setting the :background to something like 'unspecified so the 'default font value gets inserted for that particular attribute? Apart from the values given below, each face attribute can have the value unspecified. This special value means that the face doesn't specify that attribute directly. An unspecified attribute tells Emacs to refer instead to a parent face (see the description :inherit attribute below); or, failing that, to an underlying face (see Displaying Faces). The default face must specify all attributes. – lawlist Jan 28 '15 at 2:04
  • Mmh, I can try. But the issue is the foreground here. The background is as I want it (unchanged). As you can see the sample has a black foreground instead of the specified #656555. – Mathieu Marques Jan 28 '15 at 2:05
  • If a variable is a face, then the way you are trying won't work. It might work if the variable is a color. – lawlist Jan 28 '15 at 2:18
1

All 16777215 Hex colours should work on a properly configured build.

The command M-x list-colors-display is to help when selecting colours on a < 24bit display. (and to list named colours.)

The problem appears to be that the colour space that your EmacsForOSX Emacs.app bundle was built with is broken.

#656555 just so happens to fall out of the space on this build.

On OSX I would recommend building with Homebrew and --srgb, ie.

brew install --cocoa --srgb emacs

Better yet use the Mac specific patch from Yamamoto Mitsuharu at Chiba University.

Xin Xu (@railwaycat) hosts a homebrew tap on github, so it's easier to install than applying the patch manually / and compiling. Just do this:

brew tap railwaycat/emacsmacport
brew install emacs-mac

A Quick note on Homebrew .app installs

The standard way that Homebrew installs .app bundles is to symlink them. (using brew linkapps)

This is done because the Homebrew team (currently) wish to avoid touching the filesystem outside of /usr/local as much as possible.

Unfortunately this is problematic for users who rely on Spotlight to launch apps. I'd hazard a guess that Emacs users would prefer this method as it's more keyboard centric.

It is possible to use an OSX "alias" instead of a symlink, these are indexed by Spotlight, although the ranking in results places "aliases" very low. Yosemite's new Spotlight interface seems also to not show them under some conditions I haven't fully determined (I don't use Yosemite on any day-to-day machines, and it's being removed until at least Q4 2015 from some other machines I use, so I can't commit to testing this exhaustively.)

That said, there is no reason at all that the .app bundles should be located outside of /Applications/ or ~/Applications/ so I strongly recommend simply moving the Emacs.app bundle there, just as you would if you were installing it from a .dmg.

Note that the Homebrew build will place other resources in the /usr/local/Cellar/emacs (or emacs-mac) folder. This will not cause problems however.


See it working in these screenshots...

eval in scratch

updated value shown in customize

selected region coloured as expected

  • Thanks for the very detailed answer. Didn't know about Yamamoto Mitsuharu's version. I've seen the Cocoa one but I didn't like that fact that I couldn't find Emacs through the Spotlight search (links don't appear there). – Mathieu Marques Jan 29 '15 at 1:41
  • Actually, that's just due to the way Homebrew installs .app packages. The best way, without a doubt, is to mv the Emacs.app into /Applications/ and not symlink it. (Symlinks are not recognised/indexed by Spotlight.) - You can use a OSX Alias, which is like a symlink, which are indexed by Spotlight, however, they are relegated to low ranking in results, I've also noticed Yosemite won't even show them in the re-working of Spotlight. So to re-iterate, move the Emacs.app into /Applications/ for a happy, trouble-free time. – ocodo Jan 29 '15 at 3:17
  • Ok thanks I thought of that but cp'ed to /Users/angrybacon/Applications/... By the way, what are the differences between cocoa and railwaycat ports ? Edit: nevermind, github.com/railwaycat/emacs-mac-port/blob/master/README-mac : ) – Mathieu Marques Jan 29 '15 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.