changeset 75238:975531dd9b08

(mac-ae-quit-application): New function. (mac-apple-event-map): Bind "quit application" Apple event to it.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Mon, 15 Jan 2007 08:10:22 +0000
parents 2855dcf47442
children 37c56b5778df
files lisp/term/mac-win.el
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/mac-win.el	Sun Jan 14 23:17:59 2007 +0000
+++ b/lisp/term/mac-win.el	Mon Jan 15 08:10:22 2007 +0000
@@ -1714,6 +1714,15 @@
 	      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 @@
   '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)