10

Inactive Minibuffer

I tried it with the following settings:

(add-hook 'minibuffer-setup-hook
      (lambda ()
        (make-local-variable 'face-remapping-alist)
        (add-to-list 'face-remapping-alist '(default (:background "green")))))

(set-face-background 'minibuffer-prompt "blue")

but they only affected the active minibuffer:

Active Minibuffer

2
  • 1
    I believe that's also called the echo area.
    – Malabarba
    Oct 18, 2014 at 12:38
  • 1
    @Malabarba: It is only called the echo area (when the minibuffer is inactive).
    – Drew
    Oct 18, 2014 at 15:22

3 Answers 3

6

minibuffer-setup-hook is used only when the minibuffer is set up, i.e., activated, not when it is deactivated.

minibuffer-exit-hook takes effect when the minibuffer is exited. There is also minibuffer-inactive-mode-hook.

But although those do initiate the color change (as shown by adding (debug) at the beginning of the hook function, and then stepping through the debugger with d), it seems that kill-local-variables removes the added color at some point. I don't have time now to check further, but perhaps you can, or perhaps someone else has a quick solution. Sorry for providing only incomplete info.

Gotta go now - but quickly, I'm guessing that maybe you don't need to fiddle with hooks at all, and you can just do the face remapping for all buffers with names matching \` \*Minibuf-[0-9]+\*\'.


FWIW, I use a separate minibuffer frame, and I put this on minibuffer-exit-hook to color the frame background:

(defun 1on1-color-minibuffer-frame-on-exit ()
  "Change background of minibuffer frame to reflect the minibuffer depth.
Use this when reducing the minibuffer recursion depth."
  (when 1on1-minibuffer-frame
    (save-window-excursion
      (select-frame 1on1-minibuffer-frame)
      (cond ((= (minibuffer-depth) 2)
             (set-background-color 1on1-active-minibuffer-frame-background))
            ((< (minibuffer-depth) 2)
             (set-background-color 1on1-inactive-minibuffer-frame-background))
            (t
             (set-background-color (hexrgb-increment-hue ; Change bg hue slightly.
                                    (frame-parameter nil 'background-color)
                                    1on1-color-minibuffer-frame-on-exit-increment)))))))
3
  • Given your analysis, I guess making face-remapping-alist permanent would work? For the backquotes in code markup, see this answer. Oct 18, 2014 at 19:43
  • The link you provided results in a 404. Aug 16, 2018 at 16:49
  • @ComproPrasad: Fixed. Thx.
    – Drew
    Aug 28, 2018 at 4:26
4

You might try:

(dolist (buf '(" *Echo Area 0*" " *Echo Area 1*"))
  (with-current-buffer (get-buffer buf)
    (make-local-variable 'face-remapping-alist)
    (add-to-list 'face-remapping-alist '(default (:background "green")))))
1
  • Font color remans as white on me end, is it possible to to change font color as well?
    – alper
    Apr 5, 2021 at 20:50
0

I'm about to look into this in detail, but from the opposite point of view, highlighted when active, because boomer eyes. The minibuffer is a true, if specialized window/buffer, so I'm going to try simply setting the bg color to "noticeable" in the setup hook and "normal" in the exit hook. If that works then you can set the highlight you set the color when it first appears, then do that in reverse. Changing bg colors using

(cl-defun dp-set-buffer-background-color (color
                                          &optional buffer
                                          &key begin end (widenp t)
                                          &allow-other-keys))

Although there are certainly better ways. This is very old.

Your Answer

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

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