From ffcee8d7c43cef38612c39554212a5a20b75e05b Mon Sep 17 00:00:00 2001 From: Sam Steingold Date: Wed, 5 Dec 2012 13:13:38 -0500 Subject: [PATCH] * lisp/gnus/gnus.el (gnus-delete-gnus-frame): Extract from `gnus-other-frame'. (gnus-other-frame): Add `gnus-delete-gnus-frame' to `gnus-suspend-gnus-hook' in addition to `gnus-exit-gnus-hook'. --- lisp/gnus/ChangeLog | 6 ++++++ lisp/gnus/gnus.el | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 1a2df907271..522c688fc13 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,9 @@ +2012-12-05 Sam Steingold + + * gnus.el (gnus-delete-gnus-frame): Extract from `gnus-other-frame'. + (gnus-other-frame): Add `gnus-delete-gnus-frame' to + `gnus-suspend-gnus-hook' in addition to `gnus-exit-gnus-hook'. + 2012-12-05 Katsumi Yamaoka * gmm-utils.el (gmm-called-interactively-p): Revert. diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 8fbde5c8ecc..70e7f711f3d 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -4348,6 +4348,14 @@ server." (interactive "P") (gnus arg nil 'slave)) +(defun gnus-delete-gnus-frame () + "Delete gnus frame unless it is the only one. +Used for `gnus-exit-gnus-hook' in `gnus-other-frame'." + (when (and (frame-live-p gnus-other-frame-object) + (cdr (frame-list))) + (delete-frame gnus-other-frame-object)) + (setq gnus-other-frame-object nil)) + ;;;###autoload (defun gnus-other-frame (&optional arg display) "Pop up a frame to read news. @@ -4388,12 +4396,13 @@ current display is used." (if alive (switch-to-buffer gnus-group-buffer) (funcall gnus-other-frame-function arg) - (add-hook 'gnus-exit-gnus-hook - (lambda nil - (when (and (frame-live-p gnus-other-frame-object) - (cdr (frame-list))) - (delete-frame gnus-other-frame-object)) - (setq gnus-other-frame-object nil))))))) + (add-hook 'gnus-exit-gnus-hook 'gnus-delete-gnus-frame) + ;; One might argue that `gnus-delete-gnus-frame' should not be called + ;; from `gnus-suspend-gnus-hook', but, on the other hand, one might + ;; argue that it should. No matter what you think, for the sake of + ;; those who want it to be called from it, please keep (defun + ;; gnus-delete-gnus-frame) even if you remove the next `add-hook'. + (add-hook 'gnus-suspend-gnus-hook 'gnus-delete-gnus-frame))))) ;;;###autoload (defun gnus (&optional arg dont-connect slave) -- 2.39.2