From f0a105764675324e5ea1f64f5592ab79a9da001f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 2 Feb 2014 15:10:50 +0100 Subject: [PATCH] Disallow suspend-emacs under NS * 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 | 6 ++++++ lisp/term/ns-win.el | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 01ea576644..03d09cc8aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-02-02 Jan Djärv + + * 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 * progmodes/cc-defs.el (c-find-assignment-for-mode): Make loading cc-mode silent. diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index ba6519f3c0..d91b594671 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -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. -- 2.20.1