[Top][All Lists]

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

[Emacs-diffs] emacs-26 43e2aaf: Don't bind dframe events on load (Bug#29

From: Noam Postavsky
Subject: [Emacs-diffs] emacs-26 43e2aaf: Don't bind dframe events on load (Bug#29599)
Date: Tue, 2 Jan 2018 20:58:15 -0500 (EST)

branch: emacs-26
commit 43e2aafae306d9f7a463cba301d0253db846e20d
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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 9b0e550..12cedaf 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 
 ;;; 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.

reply via email to

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