comparison lisp/term/mac-win.el @ 82347:fa6a18bcd764

(mac-ae-reopen-application): New function. (mac-apple-event-map): Bind "reopen application" Apple event to it.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Fri, 10 Aug 2007 10:13:25 +0000
parents b98604865ea0
children 3d3fbe15d8ec 5b644ae74c91 424b655804ca
comparison
equal deleted inserted replaced
82346:5aed737f6143 82347:fa6a18bcd764
1708 (dolist (modifier-mask mac-keyboard-modifier-mask-alist) 1708 (dolist (modifier-mask mac-keyboard-modifier-mask-alist)
1709 (if (/= (logand modifiers-value (cdr modifier-mask)) 0) 1709 (if (/= (logand modifiers-value (cdr modifier-mask)) 0)
1710 (setq modifiers (cons (car modifier-mask) modifiers))))) 1710 (setq modifiers (cons (car modifier-mask) modifiers)))))
1711 modifiers)) 1711 modifiers))
1712 1712
1713 (defun mac-ae-reopen-application (event)
1714 "Show some frame in response to the Apple event EVENT.
1715 The frame to be shown is chosen from visible or iconified frames
1716 if possible. If there's no such frame, a new frame is created."
1717 (interactive "e")
1718 (unless (frame-visible-p (selected-frame))
1719 (let ((frame (or (car (visible-frame-list))
1720 (car (filtered-frame-list 'frame-visible-p)))))
1721 (if frame
1722 (select-frame frame)
1723 (switch-to-buffer-other-frame "*scratch*"))))
1724 (select-frame-set-input-focus (selected-frame)))
1725
1713 (defun mac-ae-open-documents (event) 1726 (defun mac-ae-open-documents (event)
1714 "Open the documents specified by the Apple event EVENT." 1727 "Open the documents specified by the Apple event EVENT."
1715 (interactive "e") 1728 (interactive "e")
1716 (let ((ae (mac-event-ae event))) 1729 (let ((ae (mac-event-ae event)))
1717 (dolist (file-name (mac-ae-list ae nil 'undecoded-file-name)) 1730 (dolist (file-name (mac-ae-list ae nil 'undecoded-file-name))
1764 ;; Accept it as an Apple event, but no Emacs event is generated so as 1777 ;; Accept it as an Apple event, but no Emacs event is generated so as
1765 ;; not to erase the splash screen. 1778 ;; not to erase the splash screen.
1766 (define-key mac-apple-event-map [core-event open-application] 0) 1779 (define-key mac-apple-event-map [core-event open-application] 0)
1767 1780
1768 ;; Received when a dock or application icon is clicked and Emacs is 1781 ;; Received when a dock or application icon is clicked and Emacs is
1769 ;; already running. Simply ignored. Another idea is to make a new 1782 ;; already running.
1770 ;; frame if all frames are invisible. 1783 (define-key mac-apple-event-map [core-event reopen-application]
1771 (define-key mac-apple-event-map [core-event reopen-application] 'ignore) 1784 'mac-ae-reopen-application)
1772 1785
1773 (define-key mac-apple-event-map [core-event open-documents] 1786 (define-key mac-apple-event-map [core-event open-documents]
1774 'mac-ae-open-documents) 1787 'mac-ae-open-documents)
1775 (define-key mac-apple-event-map [core-event show-preferences] 'customize) 1788 (define-key mac-apple-event-map [core-event show-preferences] 'customize)
1776 (define-key mac-apple-event-map [core-event quit-application] 1789 (define-key mac-apple-event-map [core-event quit-application]