# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1186740805 0 # Node ID fa6a18bcd764a0834cfcdabea41d3d4366b40d1e # Parent 5aed737f614303eb2568f079b528fd820632ce78 (mac-ae-reopen-application): New function. (mac-apple-event-map): Bind "reopen application" Apple event to it. diff -r 5aed737f6143 -r fa6a18bcd764 lisp/term/mac-win.el --- a/lisp/term/mac-win.el Fri Aug 10 10:13:05 2007 +0000 +++ b/lisp/term/mac-win.el Fri Aug 10 10:13:25 2007 +0000 @@ -1710,6 +1710,19 @@ (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") @@ -1766,9 +1779,9 @@ (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)