From 43e2aafae306d9f7a463cba301d0253db846e20d Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 18 Dec 2017 20:30:10 -0500 Subject: [PATCH] Don't bind dframe events on load (Bug#29599) * lisp/dframe.el (dframe-setup-hook): New hook. (dframe-set-special-events): New function, containing previous top-level key binding code. (top-level): Add it to dframe-setup-hook. (dframe-frame-mode): Run the hook. --- lisp/dframe.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lisp/dframe.el b/lisp/dframe.el index 9b0e550728a..12cedaf5201 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el @@ -288,6 +288,7 @@ CREATE-HOOK is a hook to run after creating a frame." (set frame-var nil)) ;; Set this as our currently attached frame (setq dframe-attached-frame (selected-frame)) + (run-hooks 'dframe-setup-hook) (run-hooks popup-hook) ;; Updated the buffer passed in to contain all the hacks needed ;; to make it work well in a dedicated window. @@ -543,16 +544,21 @@ CACHE-VAR and BUFFER-VAR are symbols as in `dframe-frame-mode'." ))) ;;; Special frame event proxies -;; -(if (boundp 'special-event-map) - (progn - (define-key special-event-map [make-frame-visible] - 'dframe-handle-make-frame-visible) - (define-key special-event-map [iconify-frame] - 'dframe-handle-iconify-frame) - (define-key special-event-map [delete-frame] - 'dframe-handle-delete-frame)) - ) +(defvar dframe-setup-hook nil + "Used for setting frame special event bindings.") + +(defun dframe-set-special-events () + (define-key special-event-map [make-frame-visible] + 'dframe-handle-make-frame-visible) + (define-key special-event-map [iconify-frame] + 'dframe-handle-iconify-frame) + (define-key special-event-map [delete-frame] + 'dframe-handle-delete-frame) + ;; Only need to run once. + (remove-hook 'dframe-setup-hook #'dframe-set-special-events)) + +(when (boundp 'special-event-map) + (add-hook 'dframe-setup-hook #'dframe-set-special-events)) (defvar dframe-make-frame-visible-function nil "Function used when a dframe controlled frame is de-iconified. -- 2.39.2