* gnus.el (gnus-other-frame-parameters): New user option.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 21 Aug 2002 13:19:23 +0000 (13:19 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 21 Aug 2002 13:19:23 +0000 (13:19 +0000)
(gnus-other-frame-object): New variable.
(gnus-other-frame): Make it search for existing Gnus frame;
 don't read new news;
 delete frame on exit.

* gnus-util.el (gnus-select-frame-set-input-focus): New function.

* lpath.el: Fbind w32-focus-frame and x-focus-frame.

lisp/ChangeLog
lisp/gnus-util.el
lisp/gnus.el
lisp/lpath.el

index 01317f9..6a8553c 100644 (file)
@@ -1,3 +1,14 @@
+2002-08-21  Katsumi Yamaoka <yamaoka@jpl.org>
+
+       * gnus.el (gnus-other-frame-parameters): New user option.
+       (gnus-other-frame-object): New variable.
+       (gnus-other-frame): Make it search for existing Gnus frame; don't
+       read new news; delete frame on exit.
+
+       * gnus-util.el (gnus-select-frame-set-input-focus): New function.
+
+       * lpath.el: Fbind w32-focus-frame and x-focus-frame.
+
 2002-08-20  Katsumi Yamaoka <yamaoka@jpl.org>
        From \e$B>.4X\e(B \e$B5HB'\e(B (KOSEKI Yoshinori) <kose@meadowy.org>.
 
index 887d7a6..6b8e96e 100644 (file)
@@ -1264,6 +1264,29 @@ CHOICE is a list of the choice char and help message at IDX."
        (kill-buffer buf))
     tchar))
 
+(defun gnus-select-frame-set-input-focus (frame)
+  "Select FRAME, raise it, and set input focus, if possible."
+  (cond ((featurep 'xemacs)
+        (raise-frame frame)
+        (select-frame frame)
+        (focus-frame frame))
+       ;; The function `select-frame-set-input-focus' won't set
+       ;; the input focus under Emacs 21.2 and X window system.
+       ;;((fboundp 'select-frame-set-input-focus)
+       ;; (defalias 'gnus-select-frame-set-input-focus
+       ;;   'select-frame-set-input-focus)
+       ;; (select-frame-set-input-focus frame))
+       (t
+        (raise-frame frame)
+        (select-frame frame)
+        (cond ((and (eq window-system 'x)
+                    (fboundp 'x-focus-frame))
+               (x-focus-frame frame))
+              ((eq window-system 'w32)
+               (w32-focus-frame frame)))
+        (when focus-follows-mouse
+          (set-mouse-position frame (1- (frame-width frame)) 0)))))
+
 (provide 'gnus-util)
 
 ;;; gnus-util.el ends here
index 508a8ae..e9e263f 100644 (file)
@@ -1820,6 +1820,18 @@ Putting (gnus-agentize) in ~/.gnus is obsolete by (setq gnus-agent t)."
   :group 'gnus-agent
   :type 'boolean)
 
+(defcustom gnus-other-frame-parameters nil
+  "Frame parameters used by `gnus-other-frame' to create a Gnus frame.
+This should be an alist for FSF Emacs, or a plist for XEmacs."
+  :group 'gnus-start
+  :type (if (featurep 'xemacs)
+           '(repeat (list :inline t :format "%v"
+                          (symbol :tag "Property")
+                          (sexp :tag "Value")))
+         '(repeat (cons :format "%v"
+                        (symbol :tag "Parameter")
+                        (sexp :tag "Value")))))
+
 \f
 ;;; Internal variables
 
@@ -1991,6 +2003,9 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
 (defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
   "Regexp matching invalid groups.")
 
+(defvar gnus-other-frame-object nil
+  "A frame object which will be created by `gnus-other-frame'.")
+
 ;;; End of variables.
 
 ;; Define some autoload functions Gnus might use.
@@ -3363,12 +3378,31 @@ server."
 (defun gnus-other-frame (&optional arg)
   "Pop up a frame to read news."
   (interactive "P")
-  (let ((window (get-buffer-window gnus-group-buffer)))
-    (cond (window
-          (select-frame (window-frame window)))
-         (t
-          (select-frame (make-frame)))))
-  (gnus arg))
+  (let ((alive (gnus-alive-p)))
+    (or (and alive
+            (catch 'found
+              (walk-windows
+               (lambda (window)
+                 (when (with-current-buffer (window-buffer window)
+                         (string-match "\\`gnus-.+-mode\\'"
+                                       (symbol-name major-mode)))
+                   (gnus-select-frame-set-input-focus
+                    (setq gnus-other-frame-object (window-frame window)))
+                   (select-window window)
+                   (throw 'found t)))
+               'ignore t)))
+       (gnus-select-frame-set-input-focus
+        (setq gnus-other-frame-object
+              (make-frame gnus-other-frame-parameters)))
+       (if alive
+           (switch-to-buffer gnus-group-buffer)
+         (gnus 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)))))))
 
 ;;(setq thing ?                                ; this is a comment
 ;;      more 'yes)
index 1bc8013..af537bf 100644 (file)
@@ -42,7 +42,8 @@
               url-insert-file-contents
               w3-coding-system-for-mime-charset w3-prepare-buffer w3-region
               w3m-charset-to-coding-system w3m-region
-              widget-make-intangible x-defined-colors))
+              widget-make-intangible x-defined-colors
+              w32-focus-frame x-focus-frame))
 
 (maybe-bind '(adaptive-fill-first-line-regexp
              adaptive-fill-regexp babel-history babel-translations
   )
 
 (defun nnkiboze-score-file (a)
-)
+  )
 
 (provide 'lpath)