* gnus.el (gnus-other-frame-function): New user option.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 26 Aug 2002 13:33:51 +0000 (13:33 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 26 Aug 2002 13:33:51 +0000 (13:33 +0000)
(gnus-other-frame): Use it;
 add a doc-string;
 make it work with the gnuclient program.

* gnus-util.el (gnus-frame-or-window-display-name): New function.

* lpath.el: Fbind `frame-parameter', `make-frame-on-display',
 `device-connection' and `dfw-device'.

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

index 5557c06..b3d3532 100644 (file)
@@ -1,3 +1,14 @@
+2002-08-26  Katsumi Yamaoka <yamaoka@jpl.org>
+
+       * gnus.el (gnus-other-frame-function): New user option.
+       (gnus-other-frame): Use it; add a doc-string; make it work with
+       the gnuclient program.
+
+       * gnus-util.el (gnus-frame-or-window-display-name): New function.
+
+       * lpath.el: Fbind `frame-parameter', `make-frame-on-display',
+       `device-connection' and `dfw-device'.
+
 2002-08-22  Kai Gro\e,b_\e(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 
        * gnus-art.el (gnus-emphasis-alist): Strikethru had a lot of false
index 6b8e96e..c11726a 100644 (file)
@@ -1287,6 +1287,16 @@ CHOICE is a list of the choice char and help message at IDX."
         (when focus-follows-mouse
           (set-mouse-position frame (1- (frame-width frame)) 0)))))
 
+(defun gnus-frame-or-window-display-name (object)
+  "Given a frame or window, return the associated display name.
+Return nil otherwise."
+  (if (featurep 'xemacs)
+      (device-connection (dfw-device object))
+    (if (or (framep object)
+           (and (windowp object)
+                (setq object (window-frame object))))
+       (frame-parameter object 'display))))
+
 (provide 'gnus-util)
 
 ;;; gnus-util.el ends here
index 92f4df1..3c3e589 100644 (file)
@@ -1820,6 +1820,14 @@ Putting (gnus-agentize) in ~/.gnus is obsolete by (setq gnus-agent t)."
   :group 'gnus-agent
   :type 'boolean)
 
+(defcustom gnus-other-frame-function 'gnus
+  "Function called by the command `gnus-other-frame'."
+  :group 'gnus-start
+  :type '(choice (function-item gnus)
+                (function-item gnus-no-server)
+                (function-item gnus-slave)
+                (function-item gnus-slave-no-server)))
+
 (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."
@@ -3375,17 +3383,32 @@ server."
   (gnus arg nil 'slave))
 
 ;;;###autoload
-(defun gnus-other-frame (&optional arg)
-  "Pop up a frame to read news."
+(defun gnus-other-frame (&optional arg display)
+  "Pop up a frame to read news.
+This will call one of the Gnus commands which is specified by the user
+option `gnus-other-frame-function' (default `gnus') with the argument
+ARG if Gnus is not running, otherwise just pop up a Gnus frame.  The
+optional second argument DISPLAY should be a standard display string
+such as \"unix:0\" to specify where to pop up a frame.  If DISPLAY is
+omitted or the function `make-frame-on-display' is not available, the
+current display is used."
   (interactive "P")
+  (if (fboundp 'make-frame-on-display)
+      (unless display
+       (setq display (gnus-frame-or-window-display-name (selected-frame))))
+    (setq display nil))
   (let ((alive (gnus-alive-p)))
     (unless (and alive
                 (catch 'found
                   (walk-windows
                    (lambda (window)
-                     (when (with-current-buffer (window-buffer window)
-                             (string-match "\\`gnus-.+-mode\\'"
-                                           (symbol-name major-mode)))
+                     (when (and (or (not display)
+                                    (equal display
+                                           (gnus-frame-or-window-display-name
+                                            window)))
+                                (with-current-buffer (window-buffer window)
+                                  (string-match "\\`gnus-"
+                                                (symbol-name major-mode))))
                        (gnus-select-frame-set-input-focus
                         (setq gnus-other-frame-object (window-frame window)))
                        (select-window window)
@@ -3393,10 +3416,12 @@ server."
                    'ignore t)))
       (gnus-select-frame-set-input-focus
        (setq gnus-other-frame-object
-            (make-frame gnus-other-frame-parameters)))
+            (if display
+                (make-frame-on-display display gnus-other-frame-parameters)
+              (make-frame gnus-other-frame-parameters))))
       (if alive
          (switch-to-buffer gnus-group-buffer)
-       (gnus arg)
+       (funcall gnus-other-frame-function arg)
        (add-hook 'gnus-exit-gnus-hook
                  (lambda nil
                    (when (and (frame-live-p gnus-other-frame-object)
index af537bf..257e5c5 100644 (file)
@@ -92,7 +92,8 @@
                     window-edges x-color-values x-popup-menu browse-url
                     frame-char-height frame-char-width
                     url-generic-parse-url xml-parse-region
-                    make-network-process))
+                    make-network-process
+                    frame-parameter make-frame-on-display))
       (maybe-bind '(buffer-display-table
                    buffer-file-coding-system font-lock-defaults
                    global-face-data gnus-article-x-face-too-ugly
                 specifier-instance url-generic-parse-url
                 valid-image-instantiator-format-p w3-do-setup
                 window-pixel-height window-pixel-width
-                xml-parse-region make-network-process)))
+                xml-parse-region make-network-process
+                device-connection dfw-device)))
 
 (require 'custom)