1 ;;; gnus.el --- a newsreader for GNU Emacs
2 ;; Copyright (C) 1987,88,89,90,93,94,95,96 Free Software Foundation, Inc.
4 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
5 ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval '(run-hooks 'gnus-load-hook))
31 (defconst gnus-version-number "0.24"
32 "Version number for this version of Gnus.")
34 (defconst gnus-version (format "Red Gnus v%s" gnus-version-number)
35 "Version string for this version of Gnus.")
37 (defvar gnus-inhibit-startup-message nil
38 "*If non-nil, the startup message will not be displayed.")
40 (defvar gnus-play-startup-jingle nil
41 "If non-nil, play the Gnus jingle at startup.")
43 ;;; Internal variables
45 (defvar gnus-group-buffer "*Group*")
48 (autoload 'gnus-play-jingle "gnus-audio"))
54 (switch-to-buffer gnus-group-buffer)
55 (let ((buffer-read-only nil))
57 (unless gnus-inhibit-startup-message
58 (gnus-group-startup-message)
60 (when gnus-play-startup-jingle
61 (gnus-play-jingle))))))
63 (defun gnus-indent-rigidly (start end arg)
64 "Indent rigidly using only spaces and no tabs."
67 (narrow-to-region start end)
68 (indent-rigidly start end arg)
69 ;; We translate tabs into spaces -- not everybody uses
70 ;; an 8-character tab.
71 (goto-char (point-min))
72 (while (search-forward "\t" nil t)
73 (replace-match " " t t)))))
75 (defun gnus-group-startup-message (&optional x y)
76 "Insert startup message in current buffer."
77 ;; Insert the message.
102 (gnus-indent-rigidly (point-min) (point-max)
103 (/ (max (- (window-width) (or x 46)) 0) 2))
104 (goto-char (point-min))
106 (let* ((pheight (count-lines (point-min) (point-max)))
107 (wheight (window-height))
108 (rest (- wheight pheight)))
109 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
111 (goto-char (point-min))
112 (and (search-forward "Praxis" nil t)
113 (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
114 (goto-char (point-min))
115 (setq mode-line-buffer-identification gnus-version)
116 (set-buffer-modified-p t))
119 (when (string-match "gnus" (format "%s" this-command))
128 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
129 ;; If you want the cursor to go somewhere else, set these two
130 ;; functions in some startup hook to whatever you want.
131 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
132 (defalias 'gnus-group-position-point 'gnus-goto-colon)
134 ;;; Various macros and substs.
136 (defun gnus-header-from (header)
137 (mail-header-from header))
139 (defmacro gnus-gethash (string hashtable)
140 "Get hash value of STRING in HASHTABLE."
141 `(symbol-value (intern-soft ,string ,hashtable)))
143 (defmacro gnus-sethash (string value hashtable)
144 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
145 `(set (intern ,string ,hashtable) ,value))
146 (put 'nnheader-temp-write 'edebug-form-spec '(form form form))
148 (defmacro gnus-group-unread (group)
149 "Get the currently computed number of unread articles in GROUP."
150 `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
152 (defmacro gnus-group-entry (group)
153 "Get the newsrc entry for GROUP."
154 `(gnus-gethash ,group gnus-newsrc-hashtb))
156 (defmacro gnus-active (group)
157 "Get active info on GROUP."
158 `(gnus-gethash ,group gnus-active-hashtb))
160 (defmacro gnus-set-active (group active)
161 "Set GROUP's active info."
162 `(gnus-sethash ,group ,active gnus-active-hashtb))
164 (defun gnus-alive-p ()
165 "Say whether Gnus is running or not."
166 (and gnus-group-buffer
167 (get-buffer gnus-group-buffer)
169 (set-buffer gnus-group-buffer)
170 (eq major-mode 'gnus-group-mode))))
172 ;; Info access macros.
174 (defmacro gnus-info-group (info)
176 (defmacro gnus-info-rank (info)
178 (defmacro gnus-info-read (info)
180 (defmacro gnus-info-marks (info)
182 (defmacro gnus-info-method (info)
184 (defmacro gnus-info-params (info)
187 (defmacro gnus-info-level (info)
188 `(let ((rank (gnus-info-rank ,info)))
192 (defmacro gnus-info-score (info)
193 `(let ((rank (gnus-info-rank ,info)))
194 (or (and (consp rank) (cdr rank)) 0)))
196 (defmacro gnus-info-set-group (info group)
197 `(setcar ,info ,group))
198 (defmacro gnus-info-set-rank (info rank)
199 `(setcar (nthcdr 1 ,info) ,rank))
200 (defmacro gnus-info-set-read (info read)
201 `(setcar (nthcdr 2 ,info) ,read))
202 (defmacro gnus-info-set-marks (info marks &optional extend)
204 `(gnus-info-set-entry ,info ,marks 3)
205 `(setcar (nthcdr 3 ,info) ,marks)))
206 (defmacro gnus-info-set-method (info method &optional extend)
208 `(gnus-info-set-entry ,info ,method 4)
209 `(setcar (nthcdr 4 ,info) ,method)))
210 (defmacro gnus-info-set-params (info params &optional extend)
212 `(gnus-info-set-entry ,info ,params 5)
213 `(setcar (nthcdr 5 ,info) ,params)))
215 (defun gnus-info-set-entry (info entry number)
216 ;; Extend the info until we have enough elements.
217 (while (< (length info) number)
218 (nconc info (list nil)))
220 (setcar (nthcdr number info) entry))
222 (defmacro gnus-info-set-level (info level)
223 `(let ((rank (cdr ,info)))
224 (if (consp (car rank))
225 (setcar (car rank) ,level)
226 (setcar rank ,level))))
227 (defmacro gnus-info-set-score (info score)
228 `(let ((rank (cdr ,info)))
229 (if (consp (car rank))
230 (setcdr (car rank) ,score)
231 (setcar rank (cons (car rank) ,score)))))
233 (defmacro gnus-get-info (group)
234 `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
236 ;; Byte-compiler warning.
238 ;; Find out whether the gnus-visual TYPE is wanted.
239 (defun gnus-visual-p (&optional type class)
240 (and gnus-visual ; Has to be non-nil, at least.
241 (if (not type) ; We don't care about type.
243 (if (listp gnus-visual) ; It's a list, so we check it.
244 (or (memq type gnus-visual)
245 (memq class gnus-visual))
248 ;;; Load the compatability functions.
258 (defvar gnus-shutdown-alist nil)
260 (defun gnus-add-shutdown (function &rest symbols)
261 "Run FUNCTION whenever one of SYMBOLS is shut down."
262 (push (cons function symbols) gnus-shutdown-alist))
264 (defun gnus-shutdown (symbol)
265 "Shut down everything that waits for SYMBOL."
266 (let ((alist gnus-shutdown-alist)
268 (while (setq entry (pop alist))
269 (when (memq symbol (cdr entry))
270 (funcall (car entry))))))
274 ;;; Gnus Utility Functions
277 ;; Add the current buffer to the list of buffers to be killed on exit.
278 (defun gnus-add-current-to-buffer-list ()
279 (or (memq (current-buffer) gnus-buffer-list)
280 (setq gnus-buffer-list (cons (current-buffer) gnus-buffer-list))))
282 (defun gnus-version (&optional arg)
283 "Version number of this version of Gnus.
284 If ARG, insert string at point."
286 (let ((methods gnus-valid-select-methods)
289 ;; Go through all the legal select methods and add their version
290 ;; numbers to the total version string. Only the backends that are
291 ;; currently in use will have their message numbers taken into
294 (setq meth (intern (concat (caar methods) "-version")))
296 (stringp (symbol-value meth))
297 (setq mess (concat mess "; " (symbol-value meth))))
298 (setq methods (cdr methods)))
300 (insert (message mess))
303 (defun gnus-continuum-version (version)
304 "Return VERSION as a floating point number."
305 (when (or (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
306 (string-match "^\\(.?\\)gnus-\\([0-9.]+\\)$" version))
307 (let* ((alpha (and (match-beginning 1) (match-string 1 version)))
308 (number (match-string 2 version))
310 (string-match "\\([0-9]\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?" number)
311 (setq major (string-to-number (match-string 1 number)))
312 (setq minor (string-to-number (match-string 2 number)))
313 (setq least (if (match-beginning 3)
314 (string-to-number (match-string 3 number))
318 (format "%s00%02d%02d"
320 ((member alpha '("(ding)" "d")) "4.99")
321 ((member alpha '("September" "s")) "5.01")
322 ((member alpha '("Red" "r")) "5.03"))
324 (format "%d.%02d%02d" major minor least))))))
326 (defun gnus-info-find-node ()
327 "Find Info documentation of Gnus."
329 ;; Enlarge info window if needed.
330 (let (gnus-info-buffer)
331 (Info-goto-node (cadr (assq major-mode gnus-info-nodes)))
332 (setq gnus-info-buffer (current-buffer))
333 (gnus-configure-windows 'info)))
335 ;;; More various functions.
337 (defun gnus-group-read-only-p (&optional group)
338 "Check whether GROUP supports editing or not.
339 If GROUP is nil, `gnus-newsgroup-name' will be checked instead. Note
340 that that variable is buffer-local to the summary buffers."
341 (let ((group (or group gnus-newsgroup-name)))
342 (not (gnus-check-backend-function 'request-replace-article group))))
344 (defun gnus-group-total-expirable-p (group)
345 "Check whether GROUP is total-expirable or not."
346 (let ((params (gnus-group-find-parameter group)))
347 (or (memq 'total-expire params)
348 (cdr (assq 'total-expire params)) ; (total-expire . t)
349 (and gnus-total-expirable-newsgroups ; Check var.
350 (string-match gnus-total-expirable-newsgroups group)))))
352 (defun gnus-group-auto-expirable-p (group)
353 "Check whether GROUP is total-expirable or not."
354 (let ((params (gnus-group-find-parameter group)))
355 (or (memq 'auto-expire params)
356 (cdr (assq 'auto-expire params)) ; (auto-expire . t)
357 (and gnus-auto-expirable-newsgroups ; Check var.
358 (string-match gnus-auto-expirable-newsgroups group)))))
360 (defun gnus-virtual-group-p (group)
361 "Say whether GROUP is virtual or not."
362 (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
363 gnus-valid-select-methods)))
365 (defun gnus-news-group-p (group &optional article)
366 "Return non-nil if GROUP (and ARTICLE) come from a news server."
367 (or (gnus-member-of-valid 'post group) ; Ordinary news group.
368 (and (gnus-member-of-valid 'post-mail group) ; Combined group.
369 (eq (gnus-request-type group article) 'news))))
371 ;; Returns a list of writable groups.
372 (defun gnus-writable-groups ()
373 (let ((alist gnus-newsrc-alist)
375 (while (setq group (car (pop alist)))
376 (unless (gnus-group-read-only-p group)
377 (push group groups)))
380 ;; Check whether to use long file names.
381 (defun gnus-use-long-file-name (symbol)
382 ;; The variable has to be set...
383 (and gnus-use-long-file-name
384 ;; If it isn't a list, then we return t.
385 (or (not (listp gnus-use-long-file-name))
386 ;; If it is a list, and the list contains `symbol', we
388 (not (memq symbol gnus-use-long-file-name)))))
390 ;; Generate a unique new group name.
391 (defun gnus-generate-new-group-name (leaf)
394 (while (gnus-gethash name gnus-newsrc-hashtb)
395 (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
398 (defun gnus-ephemeral-group-p (group)
399 "Say whether GROUP is ephemeral or not."
400 (gnus-group-get-parameter group 'quit-config))
402 (defun gnus-group-quit-config (group)
403 "Return the quit-config of GROUP."
404 (gnus-group-get-parameter group 'quit-config))
406 (defun gnus-simplify-mode-line ()
407 "Make mode lines a bit simpler."
408 (setq mode-line-modified "-- ")
409 (when (listp mode-line-format)
410 (make-local-variable 'mode-line-format)
411 (setq mode-line-format (copy-sequence mode-line-format))
412 (when (equal (nth 3 mode-line-format) " ")
413 (setcar (nthcdr 3 mode-line-format) " "))))
415 ;;; Servers and groups.
417 (defsubst gnus-server-add-address (method)
418 (let ((method-name (symbol-name (car method))))
419 (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
420 (not (assq (intern (concat method-name "-address")) method)))
421 (append method (list (list (intern (concat method-name "-address"))
425 (defsubst gnus-server-get-method (group method)
426 ;; Input either a server name, and extended server name, or a
427 ;; select method, and return a select method.
428 (cond ((stringp method)
429 (gnus-server-to-method method))
430 ((equal method gnus-select-method)
432 ((and (stringp (car method)) group)
433 (gnus-server-extend-method group method))
434 ((and method (not group)
435 (equal (cadr method) ""))
438 (gnus-server-add-address method))))
440 (defun gnus-server-to-method (server)
441 "Map virtual server names to select methods."
443 ;; Is this a method, perhaps?
444 (and server (listp server) server)
445 ;; Perhaps this is the native server?
446 (and (equal server "native") gnus-select-method)
447 ;; It should be in the server alist.
448 (cdr (assoc server gnus-server-alist))
449 ;; If not, we look through all the opened server
450 ;; to see whether we can find it there.
451 (let ((opened gnus-opened-servers))
453 (not (equal server (format "%s:%s" (caaar opened)
458 (defmacro gnus-method-equal (ss1 ss2)
459 "Say whether two servers are equal."
463 (and (= (length s1) (length s2))
465 (while (and s1 (member (car s1) s2))
469 (defun gnus-server-equal (m1 m2)
470 "Say whether two methods are equal."
471 (let ((m1 (cond ((null m1) gnus-select-method)
472 ((stringp m1) (gnus-server-to-method m1))
474 (m2 (cond ((null m2) gnus-select-method)
475 ((stringp m2) (gnus-server-to-method m2))
477 (gnus-method-equal m1 m2)))
479 (defun gnus-servers-using-backend (backend)
480 "Return a list of known servers using BACKEND."
481 (let ((opened gnus-opened-servers)
484 (when (eq backend (caaar opened))
485 (push (caar opened) out))
489 (defun gnus-archive-server-wanted-p ()
490 "Say whether the user wants to use the archive server."
492 ((or (not gnus-message-archive-method)
493 (not gnus-message-archive-group))
495 ((and gnus-message-archive-method gnus-message-archive-group)
498 (let ((active (cadr (assq 'nnfolder-active-file
499 gnus-message-archive-method))))
501 (file-exists-p active))))))
503 (defun gnus-group-prefixed-name (group method)
504 "Return the whole name from GROUP and METHOD."
505 (and (stringp method) (setq method (gnus-server-to-method method)))
508 (concat (format "%s" (car method))
510 (or (assoc (format "%s" (car method))
511 (gnus-methods-using 'address))
512 (gnus-server-equal method gnus-message-archive-method))
514 (not (string= (nth 1 method) "")))
515 (concat "+" (nth 1 method)))
518 (defun gnus-group-real-prefix (group)
519 "Return the prefix of the current group name."
520 (if (string-match "^[^:]+:" group)
521 (substring group 0 (match-end 0))
524 (defun gnus-group-method (group)
525 "Return the server or method used for selecting GROUP."
526 (let ((prefix (gnus-group-real-prefix group)))
527 (if (equal prefix "")
529 (let ((servers gnus-opened-servers)
531 backend possible found)
532 (if (string-match "^[^\\+]+\\+" prefix)
533 (setq backend (intern (substring prefix 0 (1- (match-end 0))))
534 server (substring prefix (match-end 0) (1- (length prefix))))
535 (setq backend (intern (substring prefix 0 (1- (length prefix))))))
537 (when (eq (caaar servers) backend)
538 (setq possible (caar servers))
539 (when (equal (cadaar servers) server)
540 (setq found (caar servers))))
542 (or (car (rassoc found gnus-server-alist))
544 (car (rassoc possible gnus-server-alist))
546 (list backend server))))))
548 (defsubst gnus-secondary-method-p (method)
549 "Return whether METHOD is a secondary select method."
550 (let ((methods gnus-secondary-select-methods)
551 (gmethod (gnus-server-get-method nil method)))
553 (not (equal (gnus-server-get-method nil (car methods))
555 (setq methods (cdr methods)))
558 (defun gnus-group-foreign-p (group)
559 "Say whether a group is foreign or not."
560 (and (not (gnus-group-native-p group))
561 (not (gnus-group-secondary-p group))))
563 (defun gnus-group-native-p (group)
564 "Say whether the group is native or not."
565 (not (string-match ":" group)))
567 (defun gnus-group-secondary-p (group)
568 "Say whether the group is secondary or not."
569 (gnus-secondary-method-p (gnus-find-method-for-group group)))
571 (defun gnus-group-find-parameter (group &optional symbol)
572 "Return the group parameters for GROUP.
573 If SYMBOL, return the value of that symbol in the group parameters."
575 (set-buffer gnus-group-buffer)
576 (let ((parameters (funcall gnus-group-get-parameter-function group)))
578 (gnus-group-parameter-value parameters symbol)
581 (defun gnus-group-get-parameter (group &optional symbol)
582 "Return the group parameters for GROUP.
583 If SYMBOL, return the value of that symbol in the group parameters."
584 (let ((params (gnus-info-params (gnus-get-info group))))
586 (gnus-group-parameter-value params symbol)
589 (defun gnus-group-parameter-value (params symbol)
590 "Return the value of SYMBOL in group PARAMS."
591 (or (car (memq symbol params)) ; It's either a simple symbol
592 (cdr (assq symbol params)))) ; or a cons.
594 (defun gnus-group-add-parameter (group param)
595 "Add parameter PARAM to GROUP."
596 (let ((info (gnus-get-info group)))
598 () ; This is a dead group. We just ignore it.
599 ;; Cons the new param to the old one and update.
600 (gnus-group-set-info (cons param (gnus-info-params info))
603 (defun gnus-group-set-parameter (group name value)
604 "Set parameter NAME to VALUE in GROUP."
605 (let ((info (gnus-get-info group)))
607 () ; This is a dead group. We just ignore it.
608 (let ((old-params (gnus-info-params info))
609 (new-params (list (cons name value))))
611 (if (or (not (listp (car old-params)))
612 (not (eq (caar old-params) name)))
613 (setq new-params (append new-params (list (car old-params)))))
614 (setq old-params (cdr old-params)))
615 (gnus-group-set-info new-params group 'params)))))
617 (defun gnus-group-add-score (group &optional score)
618 "Add SCORE to the GROUP score.
619 If SCORE is nil, add 1 to the score of GROUP."
620 (let ((info (gnus-get-info group)))
622 (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
624 ;; Function written by Stainless Steel Rat <ratinox@peorth.gweep.net>
625 (defun gnus-short-group-name (group &optional levels)
626 "Collapse GROUP name LEVELS.
627 Select methods are stripped and any remote host name is stripped down to
629 (let* ((name "") (foreign "") (depth -1) (skip 1)
632 (while (string-match "\\." group skip)
633 (setq skip (match-end 0)
636 ;; separate foreign select method from group name and collapse.
637 ;; if method contains a server, collapse to non-domain server name,
638 ;; otherwise collapse to select method
639 (if (string-match ":" group)
640 (cond ((string-match "+" group)
641 (let* ((plus (string-match "+" group))
642 (colon (string-match ":" group))
643 (dot (string-match "\\." group)))
644 (setq foreign (concat
645 (substring group (+ 1 plus)
646 (cond ((null dot) colon)
647 ((< colon dot) colon)
648 ((< dot colon) dot))) ":")
649 group (substring group (+ 1 colon))
652 (let* ((colon (string-match ":" group)))
653 (setq foreign (concat (substring group 0 (+ 1 colon)))
654 group (substring group (+ 1 colon)))
656 ;; collapse group name leaving LEVELS uncollapsed elements
658 (if (and (string-match "\\." group) (> levels 0))
659 (setq name (concat name (substring group 0 1))
660 group (substring group (match-end 0))
662 name (concat name "."))
663 (setq name (concat foreign name group)
670 ;;; Kill file handling.
673 (defun gnus-apply-kill-file ()
674 "Apply a kill file to the current newsgroup.
675 Returns the number of articles marked as read."
676 (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
677 (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
678 (gnus-apply-kill-file-internal)
681 (defun gnus-kill-save-kill-buffer ()
682 (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
683 (when (get-file-buffer file)
685 (set-buffer (get-file-buffer file))
686 (and (buffer-modified-p) (save-buffer))
687 (kill-buffer (current-buffer))))))
689 (defvar gnus-kill-file-name "KILL"
690 "Suffix of the kill files.")
692 (defun gnus-newsgroup-kill-file (newsgroup)
693 "Return the name of a kill file name for NEWSGROUP.
694 If NEWSGROUP is nil, return the global kill file name instead."
696 ;; The global KILL file is placed at top of the directory.
697 ((or (null newsgroup)
698 (string-equal newsgroup ""))
699 (expand-file-name gnus-kill-file-name
700 gnus-kill-files-directory))
701 ;; Append ".KILL" to newsgroup name.
702 ((gnus-use-long-file-name 'not-kill)
703 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
704 "." gnus-kill-file-name)
705 gnus-kill-files-directory))
706 ;; Place "KILL" under the hierarchical directory.
708 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
709 "/" gnus-kill-file-name)
710 gnus-kill-files-directory))))
714 (defun gnus-member-of-valid (symbol group)
715 "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
717 (symbol-name (car (gnus-find-method-for-group group)))
718 gnus-valid-select-methods)))
720 (defun gnus-method-option-p (method option)
721 "Return non-nil if select METHOD has OPTION as a parameter."
722 (when (stringp method)
723 (setq method (gnus-server-to-method method)))
724 (memq option (assoc (format "%s" (car method))
725 gnus-valid-select-methods)))
727 (defun gnus-server-extend-method (group method)
728 ;; This function "extends" a virtual server. If the server is
729 ;; "hello", and the select method is ("hello" (my-var "something"))
730 ;; in the group "alt.alt", this will result in a new virtual server
731 ;; called "hello+alt.alt".
734 (if (gnus-server-equal method gnus-select-method) gnus-select-method
735 (cdr (assoc (car method) gnus-server-alist))))))
738 (setcar (cdr entry) (concat (nth 1 entry) "+" group))
739 (nconc entry (cdr method)))))
741 (defun gnus-server-status (method)
742 "Return the status of METHOD."
743 (nth 1 (assoc method gnus-opened-servers)))
745 (defun gnus-group-name-to-method (group)
746 "Return a select method suitable for GROUP."
747 (if (string-match ":" group)
748 (let ((server (substring group 0 (match-beginning 0))))
749 (if (string-match "\\+" server)
750 (list (intern (substring server 0 (match-beginning 0)))
751 (substring server (match-end 0)))
752 (list (intern server) "")))
755 (defun gnus-find-method-for-group (group &optional info)
756 "Find the select method that GROUP uses."
757 (or gnus-override-method
760 (let ((info (or info (gnus-get-info group)))
763 (not (setq method (gnus-info-method info)))
764 (equal method "native"))
767 (cond ((stringp method)
768 (gnus-server-to-method method))
769 ((stringp (car method))
770 (gnus-server-extend-method group method))
773 (cond ((equal (cadr method) "")
775 ((null (cadr method))
776 (list (car method) ""))
778 (gnus-server-add-address method)))))))
780 (defun gnus-check-backend-function (func group)
781 "Check whether GROUP supports function FUNC."
782 (let ((method (if (stringp group) (car (gnus-find-method-for-group group))
784 (fboundp (intern (format "%s-%s" method func)))))
786 (defun gnus-methods-using (feature)
787 "Find all methods that have FEATURE."
788 (let ((valids gnus-valid-select-methods)
791 (if (memq feature (car valids))
792 (setq outs (cons (car valids) outs)))
793 (setq valids (cdr valids)))
796 (defun gnus-read-method (prompt)
797 "Prompt the user for a method.
798 Allow completion over sensible values."
801 prompt (append gnus-valid-select-methods gnus-server-alist)
802 nil t nil 'gnus-method-history)))
805 (setq method gnus-select-method))
806 ((assoc method gnus-valid-select-methods)
807 (list (intern method)
808 (if (memq 'prompt-address
809 (assoc method gnus-valid-select-methods))
810 (read-string "Address: ")
812 ((assoc method gnus-server-alist)
815 (list (intern method) "")))))
817 ;;; User-level commands.
820 (defun gnus-slave-no-server (&optional arg)
821 "Read network news as a slave, without connecting to local server"
823 (gnus-no-server arg t))
826 (defun gnus-no-server (&optional arg slave)
828 If ARG is a positive number, Gnus will use that as the
829 startup level. If ARG is nil, Gnus will be started at level 2.
830 If ARG is non-nil and not a positive number, Gnus will
831 prompt the user for the name of an NNTP server to use.
832 As opposed to `gnus', this command will not connect to the local server."
834 (gnus-no-server-1 arg slave))
837 (defun gnus-slave (&optional arg)
838 "Read news as a slave."
840 (gnus arg nil 'slave))
843 (defun gnus-other-frame (&optional arg)
844 "Pop up a frame to read news."
846 (if (get-buffer gnus-group-buffer)
847 (let ((pop-up-frames t))
849 (select-frame (make-frame))
853 (defun gnus (&optional arg dont-connect slave)
855 If ARG is non-nil and a positive number, Gnus will use that as the
856 startup level. If ARG is non-nil and not a positive number, Gnus will
857 prompt the user for the name of an NNTP server to use."
859 (gnus-1 arg dont-connect slave))
861 ;; Allow redefinition of Gnus functions.
867 ;;; gnus.el ends here