* 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'.
This commit is contained in:
Sam Steingold 2012-12-05 13:13:38 -05:00
parent 5602a53a2c
commit ffcee8d7c4
2 changed files with 21 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2012-12-05 Sam Steingold <sds@gnu.org>
* 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 <yamaoka@jpl.org>
* gmm-utils.el (gmm-called-interactively-p): Revert.

View file

@ -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)