*** empty log message ***
[gnus] / lisp / gnus.el
index 0d5081f..48b1179 100644 (file)
@@ -28,7 +28,7 @@
 
 (eval '(run-hooks 'gnus-load-hook))
 
-(defconst gnus-version-number "0.6"
+(defconst gnus-version-number "0.9"
   "Version number for this version of Gnus.")
 
 (defconst gnus-version (format "Red Gnus v%s" gnus-version-number)
@@ -58,6 +58,8 @@
     (save-restriction
       (narrow-to-region start end)
       (indent-rigidly start end arg)
+      ;; We translate tabs into spaces -- not everybody uses
+      ;; an 8-character tab.
       (goto-char (point-min))
       (while (search-forward "\t" nil t)
        (replace-match "        " t t)))))
@@ -315,9 +317,8 @@ If ARG, insert string at point."
   "Find Info documentation of Gnus."
   (interactive)
   ;; Enlarge info window if needed.
-  (let ((mode major-mode)
-       gnus-info-buffer)
-    (Info-goto-node (cadr (assq mode gnus-info-nodes)))
+  (let (gnus-info-buffer)
+    (Info-goto-node (cadr (assq major-mode gnus-info-nodes)))
     (setq gnus-info-buffer (current-buffer))
     (gnus-configure-windows 'info)))
 
@@ -332,7 +333,7 @@ that that variable is buffer-local to the summary buffers."
 
 (defun gnus-group-total-expirable-p (group)
   "Check whether GROUP is total-expirable or not."
-  (let ((params (gnus-info-params (gnus-get-info group))))
+  (let ((params (gnus-group-find-parameter group)))
     (or (memq 'total-expire params)
        (cdr (assq 'total-expire params)) ; (total-expire . t)
        (and gnus-total-expirable-newsgroups ; Check var.
@@ -340,7 +341,7 @@ that that variable is buffer-local to the summary buffers."
 
 (defun gnus-group-auto-expirable-p (group)
   "Check whether GROUP is total-expirable or not."
-  (let ((params (gnus-info-params (gnus-get-info group))))
+  (let ((params (gnus-group-find-parameter group)))
     (or (memq 'auto-expire params)
        (cdr (assq 'auto-expire params)) ; (auto-expire . t)
        (and gnus-auto-expirable-newsgroups ; Check var.
@@ -557,8 +558,18 @@ that that variable is buffer-local to the summary buffers."
   "Say whether the group is secondary or not."
   (gnus-secondary-method-p (gnus-find-method-for-group group)))
 
+(defun gnus-group-find-parameter (group &optional symbol)
+  "Return the group parameters for GROUP.
+If SYMBOL, return the value of that symbol in the group parameters."
+  (save-excursion
+    (set-buffer gnus-group-buffer)
+    (let ((parameters (funcall gnus-group-get-parameter-function group)))
+      (if symbol
+         (gnus-group-parameter-value parameters symbol)
+       parameters))))
+
 (defun gnus-group-get-parameter (group &optional symbol)
-  "Returns the group parameters for GROUP.
+  "Return the group parameters for GROUP.
 If SYMBOL, return the value of that symbol in the group parameters."
   (let ((params (gnus-info-params (gnus-get-info group))))
     (if symbol
@@ -600,25 +611,41 @@ If SCORE is nil, add 1 to the score of GROUP."
     (when info
       (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
 
-;; Function written by Stainless Steel Rat <ratinox@ccs.neu.edu>.
+;; Function written by Stainless Steel Rat <ratinox@peorth.gweep.net>
 (defun gnus-short-group-name (group &optional levels)
-  "Collapse GROUP name LEVELS."
-  (let* ((name "") 
-        (foreign "")
-        (depth 0) 
-        (skip 1)
+  "Collapse GROUP name LEVELS.
+Select methods are stripped and any remote host name is stripped down to
+just the host name."
+  (let* ((name "") (foreign "") (depth -1) (skip 1)
         (levels (or levels
                     (progn
                       (while (string-match "\\." group skip)
                         (setq skip (match-end 0)
                               depth (+ depth 1)))
                       depth))))
+    ;; separate foreign select method from group name and collapse.
+    ;; if method contains a server, collapse to non-domain server name,
+    ;; otherwise collapse to select method
     (if (string-match ":" group)
-       (setq foreign (substring group 0 (match-end 0))
-             group (substring group (match-end 0))))
+       (cond ((string-match "+" group)
+              (let* ((plus (string-match "+" group))
+                     (colon (string-match ":" group))
+                     (dot (string-match "\\." group)))
+                (setq foreign (concat
+                               (substring group (+ 1 plus)
+                                          (cond ((null dot) colon)
+                                                ((< colon dot) colon)
+                                                ((< dot colon) dot))) ":")
+                      group (substring group (+ 1 colon))
+                      )))
+             (t
+              (let* ((colon (string-match ":" group)))
+                (setq foreign (concat (substring group 0 (+ 1 colon)))
+                      group (substring group (+ 1 colon)))
+                ))))
+    ;; collapse group name leaving LEVELS uncollapsed elements
     (while group
-      (if (and (string-match "\\." group)
-              (> levels (- gnus-group-uncollapsed-levels 1)))
+      (if (and (string-match "\\." group) (> levels 0))
          (setq name (concat name (substring group 0 1))
                group (substring group (match-end 0))
                levels (- levels 1)
@@ -627,6 +654,7 @@ If SCORE is nil, add 1 to the score of GROUP."
              group nil)))
     name))
 
+
 \f
 ;;;
 ;;; Kill file handling.
@@ -693,10 +721,12 @@ If NEWSGROUP is nil, return the global kill file name instead."
   ;; called "hello+alt.alt".
   (let ((entry
         (gnus-copy-sequence
-         (if (equal (car method) "native") gnus-select-method
+         (if (gnus-server-equal method gnus-select-method) gnus-select-method
            (cdr (assoc (car method) gnus-server-alist))))))
-    (setcar (cdr entry) (concat (nth 1 entry) "+" group))
-    (nconc entry (cdr method))))
+    (if (not entry)
+       method
+      (setcar (cdr entry) (concat (nth 1 entry) "+" group))
+      (nconc entry (cdr method)))))
 
 (defun gnus-server-status (method)
   "Return the status of METHOD."
@@ -809,6 +839,7 @@ As opposed to `gnus', this command will not connect to the local server."
     (select-frame (make-frame))
     (gnus arg)))
 
+;;;###autoload
 (defun gnus (&optional arg dont-connect slave)
   "Read network news.
 If ARG is non-nil and a positive number, Gnus will use that as the