bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48674: Frames and minibuffer bug


From: Iris García
Subject: bug#48674: Frames and minibuffer bug
Date: Fri, 28 May 2021 11:34:13 +0200

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 <rudalics@gmx.at> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]