]> git.eshelyaron.com Git - emacs.git/commitdiff
(mac-ae-quit-application): New function.
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Mon, 15 Jan 2007 08:10:22 +0000 (08:10 +0000)
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Mon, 15 Jan 2007 08:10:22 +0000 (08:10 +0000)
(mac-apple-event-map): Bind "quit application" Apple event to it.

lisp/term/mac-win.el

index 3ba3868098957d3c591686ca3763e0bfd7b81ae7..db07315fe84e731b8ad8e5d2b0eb3e9a22e56010 100644 (file)
@@ -1714,6 +1714,15 @@ in `selection-converter-alist', which see."
              nil t)))))
   (select-frame-set-input-focus (selected-frame)))
 
+(defun mac-ae-quit-application (event)
+  "Quit the application Emacs with the Apple event EVENT."
+  (interactive "e")
+  (let ((ae (mac-event-ae event)))
+    (unwind-protect
+       (save-buffers-kill-emacs)
+      ;; Reaches here if the user has canceled the quit.
+      (mac-resume-apple-event ae -128)))) ; userCanceledErr
+
 (defun mac-ae-get-url (event)
   "Open the URL specified by the Apple event EVENT.
 Currently the `mailto' scheme is supported."
@@ -1740,7 +1749,7 @@ Currently the `mailto' scheme is supported."
   'mac-ae-open-documents)
 (define-key mac-apple-event-map [core-event show-preferences] 'customize)
 (define-key mac-apple-event-map [core-event quit-application]
-  'save-buffers-kill-emacs)
+  'mac-ae-quit-application)
 
 (define-key mac-apple-event-map [internet-event get-url] 'mac-ae-get-url)