emacs-bind-map icon indicating copy to clipboard operation
emacs-bind-map copied to clipboard

Ensure overriding minor mode is enabled in the correct buffer

Open bcc32 opened this issue 3 months ago • 0 comments

Hook onto window-state-change-functions instead of buffer-list-update-hook, since the latter does not guarantee that a just-created buffer is actually current. So, a command like the following would create, display, and select a buffer wherein the ensure-override-mode-func is never executed:

(defun display-results ()
  (interactive)
  (let ((buffer (get-buffer-create "*results*")))
    (with-current-buffer buffer
      (insert "I ran a command, and here are the results..."))
    (display-buffer buffer '(display-buffer-same-window))))

This change also has the nice side benefit of skipping the hook if a buffer is never displayed, or the window displaying it is never selected.

bcc32 avatar Nov 26 '25 20:11 bcc32