From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#48669: Inconsistent overlay placement between minibuffer-message and set-minibuffer-message Date: Sun, 06 Jun 2021 00:43:54 +0300 Organization: LINKOV.NET Message-ID: <87k0n8kl1h.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17389"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 48669@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o?= Guerra Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 06 00:29:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpen4-0004Oa-9f for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 00:29:14 +0200 Original-Received: from localhost ([::1]:51822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpen3-00026T-8d for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Jun 2021 18:29:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpems-00024K-Os for bug-gnu-emacs@gnu.org; Sat, 05 Jun 2021 18:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpems-0007gq-3m for bug-gnu-emacs@gnu.org; Sat, 05 Jun 2021 18:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lpems-0000Lk-0G for bug-gnu-emacs@gnu.org; Sat, 05 Jun 2021 18:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Jun 2021 22:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48669 X-GNU-PR-Package: emacs Original-Received: via spool by 48669-submit@debbugs.gnu.org id=B48669.16229321051292 (code B ref 48669); Sat, 05 Jun 2021 22:29:01 +0000 Original-Received: (at 48669) by debbugs.gnu.org; 5 Jun 2021 22:28:25 +0000 Original-Received: from localhost ([127.0.0.1]:50256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpemH-0000Km-0N for submit@debbugs.gnu.org; Sat, 05 Jun 2021 18:28:25 -0400 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:55937) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpemF-0000KN-P8 for 48669@debbugs.gnu.org; Sat, 05 Jun 2021 18:28:24 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 37C6840002; Sat, 5 Jun 2021 22:28:15 +0000 (UTC) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o?= Guerra"'s message of "Wed, 26 May 2021 14:50:20 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208076 Archived-At: --=-=-= Content-Type: text/plain > Would it make sense to change this behaviour (i.e. overlay > configuration) so that it is consistent in both functions? Thanks for the very useful suggestion. This could be fixed with the following patch where I tried to sync everything overlay-related from set-minibuffer-message to minibuffer-message: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=minibuffer-message-overlay.patch diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ffb74235e8..cb12226c07 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -741,7 +741,8 @@ minibuffer-message ;; Don't overwrite the face properties the caller has set (text-properties-at 0 message)) (setq message (apply #'propertize message minibuffer-message-properties))) - (let ((ol (make-overlay (point-max) (point-max) nil t t)) + (let* ((ovpos (minibuffer--message-overlay-pos)) + (ol (make-overlay ovpos ovpos nil t t)) ;; A quit during sit-for normally only interrupts the sit-for, ;; but since minibuffer-message is used at the end of a command, ;; at a time when the command has virtually finished already, a C-g @@ -755,8 +756,14 @@ minibuffer-message ;; The current C cursor code doesn't know to use the overlay's ;; marker's stickiness to figure out whether to place the cursor ;; before or after the string, so let's spoon-feed it the pos. - (put-text-property 0 1 'cursor t message)) + (put-text-property 0 1 'cursor 1 message)) (overlay-put ol 'after-string message) + ;; Make sure the overlay with the message is displayed before + ;; any other overlays in that position, in case they have + ;; resize-mini-windows set to nil and the other overlay strings + ;; are too long for the mini-window width. This makes sure the + ;; temporary message will always be visible. + (overlay-put ol 'priority 1100) (sit-for (or minibuffer-message-timeout 1000000))) (delete-overlay ol))))) --=-=-=--