unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49844: Highlight non-selected minibuffer prompt
@ 2021-08-03  7:47 Juri Linkov
  2021-08-04  7:42 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2021-08-03  7:47 UTC (permalink / raw)
  To: 49844

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: minibuffer-depth-nonselected.patch --]
[-- Type: text/x-diff, Size: 2154 bytes --]

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-03  7:47 bug#49844: Highlight non-selected minibuffer prompt Juri Linkov
@ 2021-08-04  7:42 ` Lars Ingebrigtsen
  2021-08-04  8:41   ` Juri Linkov
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-04  7:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 49844

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-04  7:42 ` Lars Ingebrigtsen
@ 2021-08-04  8:41   ` Juri Linkov
  2021-08-04  8:53     ` Lars Ingebrigtsen
  2021-11-06  2:42     ` Lars Ingebrigtsen
  0 siblings, 2 replies; 13+ messages in thread
From: Juri Linkov @ 2021-08-04  8:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49844

>> 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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-04  8:41   ` Juri Linkov
@ 2021-08-04  8:53     ` Lars Ingebrigtsen
  2021-08-04 21:32       ` Juri Linkov
  2021-11-06  2:42     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-04  8:53 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 49844

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-04  8:53     ` Lars Ingebrigtsen
@ 2021-08-04 21:32       ` Juri Linkov
  2021-08-05  5:53         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2021-08-04 21:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49844

>>> 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?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-04 21:32       ` Juri Linkov
@ 2021-08-05  5:53         ` Eli Zaretskii
  2021-08-05 11:00           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-08-05  5:53 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 49844, larsi

> From: Juri Linkov <juri@linkov.net>
> Date: Thu, 05 Aug 2021 00:32:19 +0300
> Cc: 49844@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-05  5:53         ` Eli Zaretskii
@ 2021-08-05 11:00           ` Lars Ingebrigtsen
  2021-11-06  2:41             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-05 11:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 49844, Juri Linkov

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-05 11:00           ` Lars Ingebrigtsen
@ 2021-11-06  2:41             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-06  2:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 49844, Juri Linkov

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-08-04  8:41   ` Juri Linkov
  2021-08-04  8:53     ` Lars Ingebrigtsen
@ 2021-11-06  2:42     ` Lars Ingebrigtsen
  2021-11-06 18:43       ` Juri Linkov
  1 sibling, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-06  2:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 49844

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-11-06  2:42     ` Lars Ingebrigtsen
@ 2021-11-06 18:43       ` Juri Linkov
  2021-11-06 21:14         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2021-11-06 18:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49844

>>> 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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-11-06 18:43       ` Juri Linkov
@ 2021-11-06 21:14         ` Lars Ingebrigtsen
  2021-11-07 17:31           ` Juri Linkov
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-06 21:14 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 49844

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-11-06 21:14         ` Lars Ingebrigtsen
@ 2021-11-07 17:31           ` Juri Linkov
  2022-08-22 11:04             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2021-11-07 17:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49844

>> 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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49844: Highlight non-selected minibuffer prompt
  2021-11-07 17:31           ` Juri Linkov
@ 2022-08-22 11:04             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-22 11:04 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 49844

Juri Linkov <juri@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?






^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-08-22 11:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03  7:47 bug#49844: Highlight non-selected minibuffer prompt Juri Linkov
2021-08-04  7:42 ` Lars Ingebrigtsen
2021-08-04  8:41   ` Juri Linkov
2021-08-04  8:53     ` Lars Ingebrigtsen
2021-08-04 21:32       ` Juri Linkov
2021-08-05  5:53         ` Eli Zaretskii
2021-08-05 11:00           ` Lars Ingebrigtsen
2021-11-06  2:41             ` Lars Ingebrigtsen
2021-11-06  2:42     ` Lars Ingebrigtsen
2021-11-06 18:43       ` Juri Linkov
2021-11-06 21:14         ` Lars Ingebrigtsen
2021-11-07 17:31           ` Juri Linkov
2022-08-22 11:04             ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).