]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/gnus/gnus.el (gnus-delete-gnus-frame): Extract from `gnus-other-frame'.
authorSam Steingold <sds@gnu.org>
Wed, 5 Dec 2012 18:13:38 +0000 (13:13 -0500)
committerSam Steingold <sds@gnu.org>
Wed, 5 Dec 2012 18:13:38 +0000 (13:13 -0500)
(gnus-other-frame): Add `gnus-delete-gnus-frame' to
`gnus-suspend-gnus-hook' in addition to `gnus-exit-gnus-hook'.

lisp/gnus/ChangeLog
lisp/gnus/gnus.el

index 1a2df907271b815b3f0e0791a155ed1342fca1f3..522c688fc13d3a01b9d8e4910f8f0da151015bc4 100644 (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.
index 8fbde5c8ecc3a341f130ca409285da98c4f4b851..70e7f711f3d426d8e61fdb31007011111d81764f 100644 (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)