Disallow suspend-emacs under NS
authorJan Djärv <jan.h.d@swipnet.se>
Sun, 2 Feb 2014 14:10:50 +0000 (15:10 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Sun, 2 Feb 2014 14:10:50 +0000 (15:10 +0100)
* term/ns-win.el (ns-suspend-error): New function.
(ns-initialize-window-system): Add ns-suspend-error to
suspend-hook.

Fixes: debbugs:16612

lisp/ChangeLog
lisp/term/ns-win.el

index 01ea576..03d09cc 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * term/ns-win.el (ns-suspend-error): New function.
+       (ns-initialize-window-system): Add ns-suspend-error to
+       suspend-hook (Bug#16612).
+
 2014-02-02  Daniel Colascione  <dancol@dancol.org>
 
        * progmodes/cc-defs.el (c-find-assignment-for-mode): Make loading cc-mode silent.
index ba6519f..d91b594 100644 (file)
@@ -863,6 +863,12 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
      (t
       nil))))
 
+(defun ns-suspend-error ()
+  ;; Don't allow suspending if any of the frames are NS frames.
+  (if (memq 'ns (mapcar 'window-system (frame-list)))
+      (error "Cannot suspend Emacs while running under NS")))
+
+
 ;; Set some options to be as Nextstep-like as possible.
 (setq frame-title-format t
       icon-title-format t)
@@ -944,6 +950,10 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
   (ns-set-resource nil "ApplePressAndHoldEnabled" "NO")
 
   (x-apply-session-resources)
+
+  ;; Don't let Emacs suspend under NS.
+  (add-hook 'suspend-hook 'ns-suspend-error)
+
   (setq ns-initialized t))
 
 ;; Any display name is OK.