From d497bce3e76a5cd503908c967bc3bf42b622c0cc Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sat, 29 Mar 2008 00:48:57 +0000 Subject: [PATCH] (mac-ae-reopen-application): New function. (mac-apple-event-map): Bind "reopen application" Apple event to it. --- lisp/ChangeLog | 5 +++++ lisp/term/mac-win.el | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 271a491e791..f105ab3a968 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-03-29 YAMAMOTO Mitsuharu + + * term/mac-win.el (mac-ae-reopen-application): New function. + (mac-apple-event-map): Bind "reopen application" Apple event to it. + 2008-03-29 Juanma Barranquero * term/mac-win.el (mac-dnd-drop-data): Remove redundant check. diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index d76af52f15f..c9c13c7814e 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el @@ -1709,6 +1709,19 @@ in `selection-converter-alist', which see." (setq modifiers (cons (car modifier-mask) modifiers))))) modifiers)) +(defun mac-ae-reopen-application (event) + "Show some frame in response to the Apple event EVENT. +The frame to be shown is chosen from visible or iconified frames +if possible. If there's no such frame, a new frame is created." + (interactive "e") + (unless (frame-visible-p (selected-frame)) + (let ((frame (or (car (visible-frame-list)) + (car (filtered-frame-list 'frame-visible-p))))) + (if frame + (select-frame frame) + (switch-to-buffer-other-frame "*scratch*")))) + (select-frame-set-input-focus (selected-frame))) + (defun mac-ae-open-documents (event) "Open the documents specified by the Apple event EVENT." (interactive "e") @@ -1765,9 +1778,9 @@ Currently the `mailto' scheme is supported." (define-key mac-apple-event-map [core-event open-application] 0) ;; Received when a dock or application icon is clicked and Emacs is -;; already running. Simply ignored. Another idea is to make a new -;; frame if all frames are invisible. -(define-key mac-apple-event-map [core-event reopen-application] 'ignore) +;; already running. +(define-key mac-apple-event-map [core-event reopen-application] + 'mac-ae-reopen-application) (define-key mac-apple-event-map [core-event open-documents] 'mac-ae-open-documents) -- 2.11.4.GIT