From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Iris =?UTF-8?Q?Garc=C3=ADa?= Newsgroups: gmane.emacs.bugs Subject: bug#48674: Frames and minibuffer bug Date: Fri, 28 May 2021 11:34:13 +0200 Message-ID: References: <1911d1b0-ed9f-7359-b28c-fbaef27df8f3@gmx.at> <1e21b121-91c1-cbe9-d9ae-24915f163ae5@gmx.at> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d6673205c36094a2" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5233"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48674@debbugs.gnu.org, Alan Mackenzie To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 28 11:35:12 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 1lmYtc-00016L-I5 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 May 2021 11:35:12 +0200 Original-Received: from localhost ([::1]:41496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmYta-0004O4-NV for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 May 2021 05:35:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmYtS-0004Ni-Ql for bug-gnu-emacs@gnu.org; Fri, 28 May 2021 05:35:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmYtS-0001qd-IA for bug-gnu-emacs@gnu.org; Fri, 28 May 2021 05:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lmYtS-00027g-Fb for bug-gnu-emacs@gnu.org; Fri, 28 May 2021 05:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Iris =?UTF-8?Q?Garc=C3=ADa?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 May 2021 09:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48674 X-GNU-PR-Package: emacs Original-Received: via spool by 48674-submit@debbugs.gnu.org id=B48674.16221944738120 (code B ref 48674); Fri, 28 May 2021 09:35:02 +0000 Original-Received: (at 48674) by debbugs.gnu.org; 28 May 2021 09:34:33 +0000 Original-Received: from localhost ([127.0.0.1]:53632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmYsy-00026u-U1 for submit@debbugs.gnu.org; Fri, 28 May 2021 05:34:33 -0400 Original-Received: from mail-ej1-f48.google.com ([209.85.218.48]:46995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmYsw-00026g-RK for 48674@debbugs.gnu.org; Fri, 28 May 2021 05:34:31 -0400 Original-Received: by mail-ej1-f48.google.com with SMTP id b9so4315454ejc.13 for <48674@debbugs.gnu.org>; Fri, 28 May 2021 02:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f2CnCB1/d/haWmEh/XV0bNUuVFD0cQsdoqMYmZoF0+U=; b=WY0Xpk1gc3Rn8cUi6KW1Ry/0QAE2RxbijPgxdPFgSTfyHnVyzLu7RzgDps9u1HYPG/ 3irXEs0cCEmB/D0XmtYiYSkIANZULBcCeNIqKVOGqhNMfN0pFAgtDJFLvtP4VHF+a6lg kdoG1thIePkT/Zy6aQ6m02kgj9omTDKxMO2+tcv2yHcf4t3O78Lnt2VQcsMXUwJ84P1T AQRvMbzEMZRp4nN2vtOExkH0LujySarEM1pkEh3qIZQQrEJ8Up1Ln0Zn3WENtVySSMN3 dRkJza6NNiKVIMAUyId3zFolK+ORmFfbiHZcE2R+XvlHC1vhYBctfeR8XX2iPnEa3Dve rEww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f2CnCB1/d/haWmEh/XV0bNUuVFD0cQsdoqMYmZoF0+U=; b=o+6mO9H8wTLpPEf97wLg3FpfyqmPUK8002baspzLpn/xT5ZvxYCWTIFB2UX98SgzNh /nFzFL5DtCtM6dCNcXDyg0wyObc/oOOr5MsFWLURGISfHVnv8VT/jxTUiAUFfH0pSJkP g0qPN5oth5BVuWiUM8e6SWzgvXVgLht5qCZRkHukgCA3KuVGKIKYQN+k1ei/xx5oU+fj ZojqBqQNqAzZKAwMkQbtwAdBuuPNM1Ft3MdeNqIz0bxHm1Oh5SzDStCBICN8PNmPIJ68 9oaUbvELYatyxdAG3TXZUx1bKGu22v2bQ6368zqGEuBp+DnPsSNi0BgGbxNQat/beGWt O93w== X-Gm-Message-State: AOAM530eifEl7oWxsvKxpi0dd4fvHvgpkNslUeENn9qzxbH0XgtMsHU7 nYBZrGxHTWwoykh9UhAbcrjYZ9pGMDasoEKjj4E= X-Google-Smtp-Source: ABdhPJwhSg5arXz+4sqeIUvTE1HpudQnrW8SXZ9APrnN/5p95pLWnrEe6KnnLet7mvZMnA68N0fWMcT0KRs82ncbiws= X-Received: by 2002:a17:907:1c20:: with SMTP id nc32mr8278774ejc.105.1622194464907; Fri, 28 May 2021 02:34:24 -0700 (PDT) In-Reply-To: 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:207449 Archived-At: --000000000000d6673205c36094a2 Content-Type: text/plain; charset="UTF-8" Hi Martin, Thanks for the comments, to be honest, my elisp knowledge is very limited and I wanted to learn by doing a modal editing package. This package has two modes: normal and insert, I like to change the cursor color and type according to the active editing mode. For this reason, I have a hook in the minibuffer, so everytime I open the minibuffer I want to switch to insert mode and this triggers the cursor update in every frame then when the minibufer is closed go back to normal mode and again update the cursor in every frame. I'm pretty sure there are better ways to achieve this, but this was the one I got working in Emacs 27. I'm happy to share the entire code if that helps but I think the point here is the bug is real and should be fixed no? In the meantime, I'll take your snippet (thanks for that) and try to edit my package to workaround the bug. Regards, Iris. On Fri, 28 May 2021 at 10:25, martin rudalics wrote: > >> The only difference is the add-hook, this time using > >> window-state-change-hook instead of minibuffer-... > >> This leads to the same bug. > > It's still the same bug. No matter what happens, evaluating > > (let ((window (selected-window))) > (dolist (frame (frame-list)) > (with-selected-frame frame)) > (eq window (selected-window))) > > must always yield t. > > Note, however, that the `with-selected-frame' in your function is not > needed. `modify-frame-parameters' works without selecting the frame > whose parameter you want to modify. Also I do not understand why you > want to modify the cursor in all windows when you enter the minibuffer. > > Consider the following snippet to set the background of the minibuffer > window when it is active (hopefully `active-minibuffer-window' always > returns the right value when exiting the minibuffer). > > > (defun foo () > (with-current-buffer (window-buffer (active-minibuffer-window)) > (set (make-local-variable 'face-remapping-alist) > '((default (:background "yellow") default))))) > > (defun bar () > (with-current-buffer (window-buffer (active-minibuffer-window)) > (set (make-local-variable 'face-remapping-alist) nil))) > > (add-hook 'minibuffer-setup-hook #'foo) > (add-hook 'minibuffer-exit-hook #'bar) > > > I never tried to remap the cursor color in a buffer-local way, but I > think you can figure out how to do that in a similar fashion. > > martin > --000000000000d6673205c36094a2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Martin,

Thanks for the co= mments, to be honest, my elisp knowledge is very limited and I wanted to le= arn by doing a modal editing package.

This package= has two modes: normal and insert, I like to change the cursor color and ty= pe according to the active editing mode.

For this = reason, I have a hook in the minibuffer, so everytime I open the minibuffer= I want to switch to insert mode and this triggers the
cursor upd= ate in every frame then when the minibufer is closed go back to normal mode= and again update the cursor in every frame.

I'= ;m pretty sure there are better ways to achieve this, but this was the one = I got working in Emacs 27.

I'm happy to share = the entire code if that helps but I think the point here is the bug is real= and should be fixed no?

In the meantime, I'll= take your snippet (thanks for that) and try to edit my package to workarou= nd the bug.

Regards,

Iris= .

On Fri, 28 May 2021 at 10:25, martin rudalics <rudalics@gmx.at> wrote:
=C2=A0>> The only difference is t= he add-hook, this time using
=C2=A0>> window-state-change-hook instead of minibuffer-...
=C2=A0>> This leads to the same bug.

It's still the same bug.=C2=A0 No matter what happens, evaluating

(let ((window (selected-window)))
=C2=A0 =C2=A0(dolist (frame (frame-list))
=C2=A0 =C2=A0 =C2=A0(with-selected-frame frame))
=C2=A0 =C2=A0(eq window (selected-window)))

must always yield t.

Note, however, that the `with-selected-frame' in your function is not needed.=C2=A0 `modify-frame-parameters' works without selecting the fra= me
whose parameter you want to modify.=C2=A0 Also I do not understand why you<= br> want to modify the cursor in all windows when you enter the minibuffer.

Consider the following snippet to set the background of the minibuffer
window when it is active (hopefully `active-minibuffer-window' always returns the right value when exiting the minibuffer).


(defun foo ()
=C2=A0 =C2=A0(with-current-buffer (window-buffer (active-minibuffer-window)= )
=C2=A0 =C2=A0 =C2=A0(set (make-local-variable 'face-remapping-alist) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'((default (:background "yellow&= quot;) default)))))

(defun bar ()
=C2=A0 =C2=A0(with-current-buffer (window-buffer (active-minibuffer-window)= )
=C2=A0 =C2=A0 =C2=A0(set (make-local-variable 'face-remapping-alist) ni= l)))

(add-hook 'minibuffer-setup-hook #'foo)
(add-hook 'minibuffer-exit-hook #'bar)


I never tried to remap the cursor color in a buffer-local way, but I
think you can figure out how to do that in a similar fashion.

martin
--000000000000d6673205c36094a2--