Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to customize my emacs so that the point color is the same as the foreground on of the character I'm standing on.

I have this now:

(defun fixpoint ()
  "awesome stuff happening to point"
  (interactive)
  (set-cursor-color (eyedrop-foreground-at-point)))

(add-hook 'post-command-hook 'fixpoint)

I'm using http://www.emacswiki.org/eyedropper.el for eyedropper.

There are 2 problems with this I'm trying to fix.

First, the hook is ran after each command which seems a bit overkill. Isn't there a hook for point motion?

Second, when highlighting matching braces, the point does not change color. I have to move forward to the next matching brace and jump back to see the actual change in point color.

share|improve this question
add comment

1 Answer 1

Dunno whether there is a better hook to use.

Wrt highlighting braces, I cannot reproduce the problem. Please provide a recipe. Keep in mind that the recipe should highlight braces, to begin with (with a foreground color). If a brace is itself just black (i.e., the default foreground color) then you will of course not notice any change.

I did this, from emacs -Q, after typing {{{}}}:

  1. Turned off font-lock-mode (so you can see the added highlighting). An alternative is to use a font-lock-* face for the highlighting.

  2. Select the braces and do this:

    (put-text-property (region-beginning) (region-end) 'face 'warning)

That puts face warning on the braces. And moving point over them makes the cursor have the same background color (DarkOrange) as warning has for its foreground.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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