]> code.delx.au - gnu-emacs/blobdiff - lisp/term/mac-win.el
(invisible-p): Remove: implemented in C now.
[gnu-emacs] / lisp / term / mac-win.el
index 0c9abe2f83738923d3e02aa3584e0c07625af7fb..e39e1fffeb0981c46ae4f68d9051b0a3436aee80 100644 (file)
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -1710,6 +1710,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")
@@ -1766,9 +1779,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)
@@ -1778,19 +1791,19 @@ Currently the `mailto' scheme is supported."
 
 (define-key mac-apple-event-map [internet-event get-url] 'mac-ae-get-url)
 
-(define-key mac-apple-event-map [hi-command about] 'display-splash-screen)
+(define-key mac-apple-event-map [hi-command about] 'about-emacs)
 
 ;;; Converted Carbon Events
 (defun mac-handle-toolbar-switch-mode (event)
   "Toggle visibility of tool-bars in response to EVENT.
 With no keyboard modifiers, it toggles the visibility of the
 frame where the tool-bar toggle button was pressed.  With some
-modifiers, it changes global tool-bar visibility setting."
+modifiers, it changes the global tool-bar visibility setting."
   (interactive "e")
   (let ((ae (mac-event-ae event)))
     (if (mac-ae-keyboard-modifiers ae)
        ;; Globally toggle tool-bar-mode if some modifier key is pressed.
-       (tool-bar-mode)
+       (tool-bar-mode 'toggle)
       (let ((frame (mac-ae-frame ae)))
        (set-frame-parameter frame 'tool-bar-lines
                             (if (= (frame-parameter frame 'tool-bar-lines) 0)