[OS X Emacs] Aquamacs Emacs 1.3rc2 (Release Candidate 2)

Jochen Küpper jochen at fhi-berlin.mpg.de
Wed Feb 6 10:57:40 EST 2008


Hi David,

On 06.02.2008, at 13:00, David Reitter wrote:

> It's set in mac-apple-event-map. It's probably easiest to define  
> your own form of
>
> (defun my-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))))
>
> (define-key mac-apple-event-map [core-event quit-application]
>  'my-mac-ae-quit-application)
>
> and set it in the -event-map.


thanks for the answer, but I fear I do not understand it.

So Ihave the following code in my .emacs:

(defun jk/save-buffers-kill-emacs ()
   "Avoid unwanted/premature exits"
   (interactive)
   (if (yes-or-no-p "Do you really wanna quit? ")
       (if jk/aquamacs-p
           (aquamacs-save-buffers-kill-emacs)
         (save-buffers-kill-emacs))
     (message "Good we are in place...")))

(if jk/aquamacs-p
     (progn
       (defun jk/mac-ae-quit-application (event)
         "Quit the application Emacs with the Apple event EVENT."
         (interactive "e")
         (let ((ae (mac-event-ae event)))
           (unwind-protect
               (jk/save-buffers-kill-emacs)
             ;; Reaches here if the user has canceled the quit.
             (mac-resume-apple-event ae -128))))
       (define-key mac-apple-event-map [core-event quit-application]  
'jk/mac-ae-quit-application)))

However, when I press A-q Aquamacs simply shuts down. I would expect  
it to ask
   (yes-or-no-p "Do you really wanna quit? ")

What am I doing wrong here?

Greetings,
Jochen
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
     Liberté, Égalité, Fraternité                GnuPG key: CC1B0B4D
         Sex, drugs and rock-n-roll





More information about the MacOSX-Emacs mailing list