How to fix emacs popup dialogs on Mac OS X?

5

3

I'm out of ideas here - my emacs crashes when popup dialog is opened. The x-popup-dialog function is probably to blame but I found no workaround to this. My Emacs version is 23.1.1 . Unfortunately some functionality of emacs calls this (e.x. customize asks whether it should save the changes) which causes the crash.

Does anybody know how to fix it or disable it?

radekg

Posted 2010-03-28T17:46:52.050

Reputation: 172

The bug is tagged moreinfo: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=2877 Maybe someone could get the ball rolling again?

– legoscia – 2010-03-29T14:41:34.050

Answers

5

Here's a quick elisp bit that will completely disable the graphical dialog for you:

(defadvice yes-or-no-p (around prevent-dialog activate)
  "Prevent yes-or-no-p from activating a dialog"
  (let ((use-dialog-box nil))
    ad-do-it))
(defadvice y-or-n-p (around prevent-dialog-yorn activate)
  "Prevent y-or-n-p from activating a dialog"
  (let ((use-dialog-box nil))
    ad-do-it))

Add this to your .emacs and it'll disable the use of the graphical dialog for the two forms of yes-or-no prompts that emacs uses.

Chris R

Posted 2010-03-28T17:46:52.050

Reputation: 1 751

1In addition to the above, you also need: (defadvice message-box (around prevent-dialog activate) "Prevent message-box from activating a dialog" (apply #'message (ad-get-args 0))) – mernst – 2014-09-23T10:15:59.117

This answer did not completely work for me, cmd-T still opens the native font chooser – Dustin Getz – 2015-02-14T19:01:30.980

That made my day. However how to prevent other events from poping dialog box? I.e. flymake insist on popping this dialog when it encounters fatal error - which crashes emacs again. Is there a way to do it on global level? – radekg – 2010-03-31T15:40:22.073

Actually, for flymake that was as easy as setting the custom-variable. – radekg – 2010-03-31T16:05:50.817

2

Wow. I had never noticed that, but x-popup-dialog seems to be a problem for me too. At least the example dialog crashed for me. How do you get customize to bring up a dialog? I can't reproduce it.

In general the rule is: if you do it from the keyboard it won't use up a dialog. e.g. use C-x k instead of the mouse to close a buffer and you'll get no dialog. Another, more heavy-handed way, is to set use-dialog-box to nil (though that doesn't stop x-popup-dialog from working if called directly so it may not fix the problem). To fix that you would probably have to advise x-popup-dialog, reimplement it using for example completing-read and never call ad-do-it. Or you could fix the bug. I'm not sure which would be easier :-)

Ivan Andrus

Posted 2010-03-28T17:46:52.050

Reputation: 696

The main problem for me is things like "cmd-T" for when I thought my browser was focused – Dustin Getz – 2015-02-14T19:02:24.390

@DustinGetz, that's a completely different problem underneath. You can fix that by unbinding the particular key, e.g. (global-set-key "\M-t" nil) – Ivan Andrus – 2015-02-14T21:41:04.357

Customize asks whether I want to save all changes for the buffer when hitting "Save for futher sessions". I thought in carbon-emacs it uses mini-buffer. :/ I will try setting use-dialog to nil and see whether it helps. But this will happen when I get home. Thanks for the answer! – None – 2010-03-29T07:42:27.593

1custom pops up a dialog if you mouse click a button, and uses the minibuffer if you hit enter on the button – Justin Smith – 2010-04-09T00:43:01.713