4

Would it be possible to change the background color of the minibuffer when it's expecting user activity? For example when a function needs a parameter or when a function name is incomplete or when you started entering "C-x" and more keys are needed etc.

I'm thinking of something like this: http://emacswiki.org/emacs/Dedicated_Minibuffer_Frame (see "Minibuffer Background Color Indicates User Activity", with lots of screenshots)

Except that the above only works when the minibuffer is in its own frame.

I'd like to have it work when the minibuffer is a "regular" minibuffer, with other buffer(s) in the same frame.

My elisp is not strong enough yet to hack a solution to this myself so any input is very welcome.

EDIT

I can change the entire buffer's background doing the following:

(add-hook 'minibuffer-setup-hook 
  (function (lambda ()
              (set-background-color "black"))))

I don't know if it's easy to change only the minibuffer's background using some "hack".

I also don't know how to change back to the previous color. I'm not sure what's the correct way to do this.

If I can't change only the mini-buffer's background then changing the entire background is ok.

2 Answers 2

4

You can simply try to set face-remap-alist via minibuffer-setup-hook. Something like:

(add-hook 'minibuffer-setup-hook
          (lambda ()
            (make-local-variable 'face-remapping-alist)
            (add-to-list 'face-remapping-alist '(default (:background "green")))))
4
  • doesn't work in every case (e.g. "F1 k" and then I need the describe the key, nothing happens) but it already does work in most of the cases). Thanks a lot. Oct 1, 2012 at 17:22
  • 1
    @CedricMartin: that's becaue F1 k does not use a minibuffer (it uses an echo area instead). I.e. it just displays messages which give you the impression it uses the minibuffer. Minibuffers and echo areas are normal buffers (you can find them in C-x b as ` *Echo Area ..*` and ` *Minbuffer-..*`), the only special thing about them is that they're usually displayed in that mini-window at the bottom of your frame.
    – Stefan
    Oct 2, 2012 at 4:09
  • ah interesting... I guess I should start a new question then asking how to "highlight" or "make more obvious" that some action should be taken "in that mini-window at the bottom of my frame" ; ) Oct 3, 2012 at 1:03
  • @CedricMartin: Yes, it's kind of difficult, because it's hard to distinguish a simple message being output in there from the specific messages output by things like isearch and C-h k. You can do it, tho, based on the value of cursor-in-echo-area, but the next problem is that there is no standard hook they run, AFAICT (i.e. nothing comparable to minibuffer-setup-hook) and you'll probably alko have to add code to reset the background face for the next normal message.
    – Stefan
    Oct 3, 2012 at 3:52
1

It isn't perfect because it does not cover all of your conditions, but you can use M-x customize-face .. minibuffer-prompt and turn on inverse video or make other customizations. It only changes the background of the text not the whole minibuffer.

This does not change C-x or any other Prefix Command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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