From: Gregory Heytings <gregory@heytings.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Is there a way to avoid clobbering minibuffer by messages?
Date: Thu, 30 Mar 2023 15:05:21 +0000 [thread overview]
Message-ID: <e246266e9f40e7a19d45@heytings.org> (raw)
In-Reply-To: <837cuy5y2m.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
>
> If that is what you see, then it's the intended behavior. That you are
> not used to it doesn't mean it's incorrect or broken. Functionally, it
> does the job, and we don't have any better alternatives for the case
> when a message should be shown when the minibuffer is active.
>
It's true that we don't have any better _built-in_ alternatives, but I
think what the OP wants is something like the code in the attached file.
[-- Attachment #2: mode-line-minibuffer-message.el --]
[-- Type: text/plain, Size: 2594 bytes --]
(defface mode-line-minibuffer-message-face
`((t (:background ,(face-attribute 'default :background))))
"")
(defvar-local mode-line-minibuffer-message-string nil)
(defvar mode-line-minibuffer-message-buffer nil)
(defvar mode-line-minibuffer-message-timer nil)
(defun mode-line-minibuffer-message-clear ()
(when (not noninteractive)
(when (timerp minibuffer-message-timer)
(cancel-timer mode-line-minibuffer-message-timer)
(setq mode-line-minibuffer-message-timer nil))
(when (buffer-live-p mode-line-minibuffer-message-buffer)
(with-current-buffer mode-line-minibuffer-message-buffer
(setq mode-line-minibuffer-message-string nil)
(force-mode-line-update)))))
(defun mode-line-minibuffer-message-set (message)
(let* ((minibuf-window (active-minibuffer-window))
(minibuf-frame (and (window-live-p minibuf-window)
(window-frame minibuf-window))))
(when (and (not noninteractive)
(window-live-p minibuf-window)
(or (eq (window-frame) minibuf-frame)
(eq (frame-parameter minibuf-frame 'minibuffer) 'only)))
(progn
(when (numberp minibuffer-message-clear-timeout)
(setq mode-line-minibuffer-message-timer
(run-with-timer minibuffer-message-clear-timeout nil
#'mode-line-minibuffer-message-clear)))
(with-current-buffer
(window-buffer
(or (window-in-direction 'above minibuf-window)
(minibuffer-selected-window)
(get-largest-window)))
(mode-line-minibuffer-message-clear)
(setq mode-line-minibuffer-message-buffer (current-buffer))
(when (and mode-line-format
(not (and (listp mode-line-format)
(assq 'mode-line-minibuffer-message-string
mode-line-format))))
(setq mode-line-format
(list '(mode-line-minibuffer-message-string
(:eval mode-line-minibuffer-message-string))
mode-line-format)))
(setq mode-line-minibuffer-message-string message)
(add-face-text-property 0 (length mode-line-minibuffer-message-string)
'mode-line-minibuffer-message-face t
mode-line-minibuffer-message-string)
(force-mode-line-update))
t))))
(setq clear-message-function #'mode-line-minibuffer-message-clear)
(setq set-message-function #'mode-line-minibuffer-message-set)
next prev parent reply other threads:[~2023-03-30 15:05 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 7:57 Is there a way to avoid clobbering minibuffer by messages? Platon Pronko
2023-03-30 8:53 ` Eli Zaretskii
2023-03-30 9:40 ` Platon Pronko
2023-03-30 10:32 ` Eli Zaretskii
2023-03-30 15:05 ` Gregory Heytings [this message]
2023-03-30 16:28 ` [External] : " Drew Adams
2023-03-30 16:35 ` Eli Zaretskii
2023-03-30 16:49 ` Drew Adams
2023-03-30 17:27 ` Eli Zaretskii
2023-03-30 17:32 ` Gregory Heytings
2023-03-30 17:51 ` Eli Zaretskii
2023-03-30 18:14 ` John Yates
2023-03-30 18:28 ` Eli Zaretskii
2023-03-30 20:08 ` John Yates
2023-03-31 6:32 ` Yuri Khan
2023-03-30 18:16 ` Gregory Heytings
2023-03-30 18:31 ` Eli Zaretskii
2023-03-30 19:37 ` Sergey Organov
2023-03-30 19:45 ` Gregory Heytings
2023-03-30 20:02 ` Gregory Heytings
2023-03-30 20:06 ` Gregory Heytings
2023-03-30 19:26 ` Jean Louis
2023-03-31 10:40 ` Eric S Fraga
2023-03-30 19:22 ` Jean Louis
2023-03-31 6:24 ` Platon Pronko
2023-03-31 6:58 ` Gregory Heytings
2023-03-31 7:01 ` Gregory Heytings
2023-03-31 7:10 ` Platon Pronko
2023-03-31 7:17 ` Gregory Heytings
2023-03-31 7:45 ` Gregory Heytings
2023-03-31 11:04 ` John Covici
2023-03-31 11:09 ` Gregory Heytings
2023-03-31 12:46 ` John Covici
2023-03-30 9:52 ` Gregory Heytings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e246266e9f40e7a19d45@heytings.org \
--to=gregory@heytings.org \
--cc=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).