GNU bug report logs - #49844
Highlight non-selected minibuffer prompt

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 3 Aug 2021 08:16:02 UTC

Severity: wishlist

Tags: patch

To reply to this bug, email your comments to 49844 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Tue, 03 Aug 2021 08:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 03 Aug 2021 08:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Highlight non-selected minibuffer prompt
Date: Tue, 03 Aug 2021 10:47:59 +0300
[Message part 1 (text/plain, inline)]
Severity: wishlist
Tags: patch

As suggested in https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00011.html
here is the patch that implements this feature:

[minibuffer-depth-nonselected.patch (text/x-diff, inline)]
diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el
index 88003afb40..ed0ebf800b 100644
--- a/lisp/mb-depth.el
+++ b/lisp/mb-depth.el
@@ -47,11 +47,36 @@ minibuffer-depth-indicator
   :group 'minibuffer
   :version "28.1")
 
+(defface minibuffer-depth-nonselected
+  '((t (:background "yellow" :foreground "dark red" :weight bold)))
+  "Face for non-selected minibuffer prompts.
+It's used after leaving the minibuffer window while the minibuffer remains active."
+  :group 'minibuffer
+  :version "28.1")
+
+(defcustom minibuffer-depth-indicate-nonselected t
+  "If non-nil, indicate the non-selected minibuffer.
+Use the face `minibuffer-depth-nonselected'."
+  :type 'boolean
+  :group 'minibuffer
+  :version "28.1")
+
 ;; An overlay covering the prompt.  This is a buffer-local variable in
 ;; each affected minibuffer.
 ;;
-(defvar minibuffer-depth-overlay)
-(make-variable-buffer-local 'minibuffer-depth-overlay)
+(defvar-local minibuffer-depth-overlay nil)
+(defvar-local minibuffer-depth-nonselected-overlay nil)
+
+(defun minibuffer-depth-select (w)
+  (if (eq (window-buffer w) (current-buffer))
+      (when (overlayp minibuffer-depth-nonselected-overlay)
+        (delete-overlay minibuffer-depth-nonselected-overlay))
+    (unless (eq major-mode 'completion-list-mode)
+      (with-current-buffer (window-buffer w)
+        (let ((ov (make-overlay (point-min) (point-max))))
+          (overlay-put ov 'face 'minibuffer-depth-nonselected)
+          (overlay-put ov 'evaporate t)
+          (setq minibuffer-depth-nonselected-overlay ov))))))
 
 ;; This function goes on minibuffer-setup-hook
 (defun minibuffer-depth-setup ()
@@ -68,7 +93,9 @@ minibuffer-depth-setup
                                          'face
                                          'minibuffer-depth-indicator)
                              " ")))
-      (overlay-put minibuffer-depth-overlay 'evaporate t))))
+      (overlay-put minibuffer-depth-overlay 'evaporate t)))
+  (when minibuffer-depth-indicate-nonselected
+    (add-hook 'window-state-change-functions 'minibuffer-depth-select nil t)))
 
 ;;;###autoload
 (define-minor-mode minibuffer-depth-indicate-mode

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Wed, 04 Aug 2021 07:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Wed, 04 Aug 2021 09:42:54 +0200
Juri Linkov <juri <at> linkov.net> writes:

> Severity: wishlist
> Tags: patch
>
> As suggested in
> https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00011.html
> here is the patch that implements this feature:

I like it -- but does this need to be tied to
minibuffer-depth-indicate-mode?  Indicating that the minibuffer isn't
active in this way may be attractive even if you don't have that
switched on?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Wed, 04 Aug 2021 08:47:03 GMT) Full text and rfc822 format available.

Message #11 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Wed, 04 Aug 2021 11:41:54 +0300
>> here is the patch that implements this feature:
>
> I like it -- but does this need to be tied to
> minibuffer-depth-indicate-mode?  Indicating that the minibuffer isn't
> active in this way may be attractive even if you don't have that
> switched on?

Yeah, I don't like tying to minibuffer-depth-indicate-mode too.
But I have no idea where to put it otherwise.
Adding a new package for 25 lines makes no sense.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Wed, 04 Aug 2021 08:54:01 GMT) Full text and rfc822 format available.

Message #14 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Wed, 04 Aug 2021 10:53:43 +0200
Juri Linkov <juri <at> linkov.net> writes:

>>> here is the patch that implements this feature:
>>
>> I like it -- but does this need to be tied to
>> minibuffer-depth-indicate-mode?  Indicating that the minibuffer isn't
>> active in this way may be attractive even if you don't have that
>> switched on?
>
> Yeah, I don't like tying to minibuffer-depth-indicate-mode too.
> But I have no idea where to put it otherwise.
> Adding a new package for 25 lines makes no sense.

Can't we just put it in minibuffer.el?  (But then there should probably
be a user option to switch it on/off.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Wed, 04 Aug 2021 22:05:01 GMT) Full text and rfc822 format available.

Message #17 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Thu, 05 Aug 2021 00:32:19 +0300
>>> I like it -- but does this need to be tied to
>>> minibuffer-depth-indicate-mode?  Indicating that the minibuffer isn't
>>> active in this way may be attractive even if you don't have that
>>> switched on?
>>
>> Yeah, I don't like tying to minibuffer-depth-indicate-mode too.
>> But I have no idea where to put it otherwise.
>> Adding a new package for 25 lines makes no sense.
>
> Can't we just put it in minibuffer.el?  (But then there should probably
> be a user option to switch it on/off.)

Ironically, minibuffer.el is intended for code that deals with
completions.  Its first line is

  ;;; minibuffer.el --- Minibuffer completion functions

But most code that deals with the minibuffer
is somewhere in the middle of simple.el.

So neither minibuffer.el nor simple.el is suitable.
Perhaps this was the reason why there are a lot of tiny
packages that provide various minibuffer features,
such as mb-depth.el, minibuf-eldef.el, rfn-eshadow.el, etc.

Maybe it would make sense to create a new file with the name e.g.
minibuf-x.el as a mixed bag of tiny minibuffer features?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Thu, 05 Aug 2021 05:54:02 GMT) Full text and rfc822 format available.

Message #20 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 49844 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Thu, 05 Aug 2021 08:53:46 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Date: Thu, 05 Aug 2021 00:32:19 +0300
> Cc: 49844 <at> debbugs.gnu.org
> 
> > Can't we just put it in minibuffer.el?  (But then there should probably
> > be a user option to switch it on/off.)
> 
> Ironically, minibuffer.el is intended for code that deals with
> completions.  Its first line is
> 
>   ;;; minibuffer.el --- Minibuffer completion functions

That's not carved in stone, though.  We could change that heading
accordingly, and start adding stuff to minibuffer.el that doesn't
necessarily deal with completion.

> But most code that deals with the minibuffer
> is somewhere in the middle of simple.el.

Which is somewhat sub-optimal, I think.

> Maybe it would make sense to create a new file with the name e.g.
> minibuf-x.el as a mixed bag of tiny minibuffer features?

I don't think a new file is justified at this time.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Thu, 05 Aug 2021 11:01:02 GMT) Full text and rfc822 format available.

Message #23 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49844 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Thu, 05 Aug 2021 13:00:20 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Ironically, minibuffer.el is intended for code that deals with
>> completions.  Its first line is
>> 
>>   ;;; minibuffer.el --- Minibuffer completion functions
>
> That's not carved in stone, though.  We could change that heading
> accordingly, and start adding stuff to minibuffer.el that doesn't
> necessarily deal with completion.

And there already is a lot of that in minibuffer.el -- just scroll to
the bottom of the file and page up a bit.  At least the last 100 lines
have nothing to do with completion.

So I think we should just change the heading and put more minibuffer
stuff in minibuffer.el.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Sat, 06 Nov 2021 02:42:01 GMT) Full text and rfc822 format available.

Message #26 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49844 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Sat, 06 Nov 2021 03:41:25 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> So I think we should just change the heading and put more minibuffer
> stuff in minibuffer.el.

I've now done so in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Sat, 06 Nov 2021 02:43:02 GMT) Full text and rfc822 format available.

Message #29 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Sat, 06 Nov 2021 03:42:18 +0100
Juri Linkov <juri <at> linkov.net> writes:

>> I like it -- but does this need to be tied to
>> minibuffer-depth-indicate-mode?  Indicating that the minibuffer isn't
>> active in this way may be attractive even if you don't have that
>> switched on?
>
> Yeah, I don't like tying to minibuffer-depth-indicate-mode too.
> But I have no idea where to put it otherwise.
> Adding a new package for 25 lines makes no sense.

Juri -- please go ahead and put this in minibuffer.el.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Sat, 06 Nov 2021 19:11:02 GMT) Full text and rfc822 format available.

Message #32 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Sat, 06 Nov 2021 20:43:31 +0200
>>> I like it -- but does this need to be tied to
>>> minibuffer-depth-indicate-mode?  Indicating that the minibuffer isn't
>>> active in this way may be attractive even if you don't have that
>>> switched on?
>>
>> Yeah, I don't like tying to minibuffer-depth-indicate-mode too.
>> But I have no idea where to put it otherwise.
>> Adding a new package for 25 lines makes no sense.
>
> Juri -- please go ahead and put this in minibuffer.el.

ISTR, in bug#50141 we decided to add more generalized code to windmove.el
that will provide 4 customizable types of window backgrounds colors
with different faces:

1. selected window
2. non-selected window
3. selected minibuffer window
4. non-selected minibuffer window




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Sat, 06 Nov 2021 21:15:02 GMT) Full text and rfc822 format available.

Message #35 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Sat, 06 Nov 2021 22:14:46 +0100
Juri Linkov <juri <at> linkov.net> writes:

> ISTR, in bug#50141 we decided to add more generalized code to windmove.el
> that will provide 4 customizable types of window backgrounds colors
> with different faces:
>
> 1. selected window
> 2. non-selected window
> 3. selected minibuffer window
> 4. non-selected minibuffer window

But...  isn't think pretty much unrelated to windmove, too?  I'd just
like to have the minibuffer light up when I've moved point somewhere
else (because it can be confusing sometimes).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Sun, 07 Nov 2021 17:48:02 GMT) Full text and rfc822 format available.

Message #38 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Sun, 07 Nov 2021 19:31:25 +0200
>> ISTR, in bug#50141 we decided to add more generalized code to windmove.el
>> that will provide 4 customizable types of window backgrounds colors
>> with different faces:
>>
>> 1. selected window
>> 2. non-selected window
>> 3. selected minibuffer window
>> 4. non-selected minibuffer window
>
> But...  isn't think pretty much unrelated to windmove, too?  I'd just
> like to have the minibuffer light up when I've moved point somewhere
> else (because it can be confusing sometimes).

This was intended to address different requests.  So far the requests
were: to highlight the background of the selected window, to highlight
the selected minibuffer window, and to highlight the non-selected
active minibuffer.  The last case actually is more complex:
the non-selected minibuffer should not be highlighted
when the Completions window is selected.  Only after moving point
out of both the minibuffer and the Completions window, the minibuffer
window should be highlighted.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49844; Package emacs. (Mon, 22 Aug 2022 11:05:02 GMT) Full text and rfc822 format available.

Message #41 received at 49844 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 49844 <at> debbugs.gnu.org
Subject: Re: bug#49844: Highlight non-selected minibuffer prompt
Date: Mon, 22 Aug 2022 13:04:48 +0200
Juri Linkov <juri <at> linkov.net> writes:

> The last case actually is more complex: the non-selected minibuffer
> should not be highlighted when the Completions window is selected.
> Only after moving point out of both the minibuffer and the Completions
> window, the minibuffer window should be highlighted.

This was a year ago -- did you make any progress here?





This bug report was last modified 2 years and 297 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.