Fix my last change.
[gnus] / lisp / gnus.el
index 73c9cf4..ea3723e 100644 (file)
@@ -32,8 +32,6 @@
 (eval-when-compile (require 'cl))
 (require 'mm-util)
 
-(require 'message)
-
 (defgroup gnus nil
   "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
   :group 'news
@@ -257,7 +255,7 @@ is restarted, and sometimes reloaded."
   :link '(custom-manual "(gnus)Exiting Gnus")
   :group 'gnus)
 
-(defconst gnus-version-number "5.8.7"
+(defconst gnus-version-number "5.8.8"
   "Version number for this version of Gnus.")
 
 (defconst gnus-version (format "Gnus v%s" gnus-version-number)
@@ -280,6 +278,8 @@ be set in `.emacs' instead."
   (defalias 'gnus-delete-overlay 'delete-overlay)
   (defalias 'gnus-overlay-put 'overlay-put)
   (defalias 'gnus-move-overlay 'move-overlay)
+  (defalias 'gnus-overlay-buffer 'overlay-buffer)
+  (defalias 'gnus-overlay-start 'overlay-start)
   (defalias 'gnus-overlay-end 'overlay-end)
   (defalias 'gnus-extent-detached-p 'ignore)
   (defalias 'gnus-extent-start-open 'ignore)
@@ -290,7 +290,28 @@ be set in `.emacs' instead."
   (defalias 'gnus-character-to-event 'identity)
   (defalias 'gnus-add-text-properties 'add-text-properties)
   (defalias 'gnus-put-text-property 'put-text-property)
-  (defalias 'gnus-mode-line-buffer-identification 'identity)
+  (defvar gnus-mode-line-image-cache t)
+  (if (fboundp 'find-image)
+      (defun gnus-mode-line-buffer-identification (line)
+       (let ((str (car-safe line)))
+         (if (and (stringp str)
+                  (string-match "^Gnus:" str))
+             (progn (add-text-properties
+                     0 5
+                     (list 'display
+                           (if (eq t gnus-mode-line-image-cache)
+                               (setq gnus-mode-line-image-cache
+                                     (find-image
+                                      '((:type xpm :file "gnus-pointer.xpm"
+                                               :ascent 80)
+                                        (:type xbm :file "gnus-pointer.xbm"
+                                               :ascent 80))))
+                             gnus-mode-line-image-cache)
+                           'help-echo "This is Gnus")
+                     str)
+                    (list str))
+           line)))
+    (defalias 'gnus-mode-line-buffer-identification 'identity))
   (defalias 'gnus-characterp 'numberp)
   (defalias 'gnus-deactivate-mark 'deactivate-mark)
   (defalias 'gnus-window-edges 'window-edges)
@@ -748,19 +769,24 @@ be set in `.emacs' instead."
   ;; Insert the message.
   (erase-buffer)
   (cond
-   ((and (fboundp 'find-image)
-        (display-graphic-p)
-        (let ((image (find-image '((:type xpm :file "gnus.xpm")
-                                   (:type xbm :file "gnus.xbm")))))
-          (when image
-            (insert-image image " ")
-            (goto-char (point-min))
-            (while (not (eobp))
-              (insert (make-string (/ (max (- (window-width) (or x 35)) 0) 2)
-                                   ?\ ))
-              (forward-line 1))
-            (setq gnus-simple-splash nil)
-            t))))
+   ((and
+     (fboundp 'find-image)
+     (display-graphic-p)
+     (let ((image (find-image
+                  `((:type xpm :file "gnus.xpm")
+                    (:type xbm :file "gnus.xbm"
+                           ;; Account for the xbm's blackground.
+                           :background ,(face-foreground 'gnus-splash-face)
+                           :foreground ,(face-background 'default))))))
+       (when image
+        (let ((size (image-size image)))
+          (insert-char ?\n (max 0 (round (- (window-height)
+                                            (or y (cdr size)) 1) 2)))
+          (insert-char ?\  (max 0 (round (- (window-width)
+                                            (or x (car size))) 2)))
+          (insert-image image))
+        (setq gnus-simple-splash nil)
+        t))))
    (t
     (insert
      (format "              %s
@@ -809,7 +835,6 @@ be set in `.emacs' instead."
 
 ;;; Do the rest.
 
-(require 'custom)
 (require 'gnus-util)
 (require 'nnheader)
 
@@ -913,13 +938,16 @@ see the manual for details."
   :type 'gnus-select-method)
 
 (defcustom gnus-message-archive-method
-  `(nnfolder
-    "archive"
-    (nnfolder-directory ,(nnheader-concat message-directory "archive"))
-    (nnfolder-active-file
-     ,(nnheader-concat message-directory "archive/active"))
-    (nnfolder-get-new-mail nil)
-    (nnfolder-inhibit-expiry t))
+  (progn
+    ;; Don't require it at top level to avoid circularity.
+    (require 'message)
+    `(nnfolder
+      "archive"
+      (nnfolder-directory ,(nnheader-concat message-directory "archive"))
+      (nnfolder-active-file
+       ,(nnheader-concat message-directory "archive/active"))
+      (nnfolder-get-new-mail nil)
+      (nnfolder-inhibit-expiry t)))
   "*Method used for archiving messages you've sent.
 This should be a mail method.
 
@@ -1019,12 +1047,12 @@ list, Gnus will try all the methods in the list until it finds a match."
   :type '(choice (const :tag "default" nil)
                 (const :tag "DejaNews" (nnweb "refer" (nnweb-type dejanews)))
                 gnus-select-method
-                (repeat :menu-tag "Try multiple" 
+                (repeat :menu-tag "Try multiple"
                         :tag "Multiple"
                         :value (current (nnweb "refer" (nnweb-type dejanews)))
                         (choice :tag "Method"
                                 (const current)
-                                (const :tag "DejaNews" 
+                                (const :tag "DejaNews"
                                        (nnweb "refer" (nnweb-type dejanews)))
                                 gnus-select-method))))
 
@@ -1085,11 +1113,6 @@ newsgroups."
   :group 'gnus-summary-marks
   :type 'character)
 
-(defcustom gnus-asynchronous nil
-  "*If non-nil, Gnus will supply backends with data needed for async article fetching."
-  :group 'gnus-asynchronous
-  :type 'boolean)
-
 (defcustom gnus-large-newsgroup 200
   "*The number of articles which indicates a large newsgroup.
 If the number of articles in a newsgroup is greater than this value,
@@ -1286,21 +1309,28 @@ this variable.  I think."
                                   (const :format "%v " virtual)
                                   (const respool)))))
 
-(define-widget 'gnus-select-method 'list
-  "Widget for entering a select method."
-  :value '(nntp "")
-  :tag "Select Method"
-  :args `((choice :tag "Method"
-                 ,@(mapcar (lambda (entry)
-                             (list 'const :format "%v\n"
-                                   (intern (car entry))))
-                           gnus-valid-select-methods))
-         (string :tag "Address")
-         (repeat :tag "Options"
-                 :inline t
-                 (list :format "%v"
-                       variable
-                       (sexp :tag "Value")))))
+(defun gnus-redefine-select-method-widget ()
+  "Recomputes the select-method widget based on the value of
+`gnus-valid-select-methods'."
+  (define-widget 'gnus-select-method 'list
+    "Widget for entering a select method."
+    :value '(nntp "")
+    :tag "Select Method"
+    :args `((choice :tag "Method"
+                   ,@(mapcar (lambda (entry)
+                               (list 'const :format "%v\n"
+                                     (intern (car entry))))
+                             gnus-valid-select-methods)
+                   (symbol :tag "other"))
+           (string :tag "Address")
+           (repeat :tag "Options"
+                   :inline t
+                   (list :format "%v"
+                         variable
+                         (sexp :tag "Value"))))
+    ))
+
+(gnus-redefine-select-method-widget)
 
 (defcustom gnus-updated-mode-lines '(group article summary tree)
   "List of buffers that should update their mode lines.
@@ -1473,6 +1503,7 @@ If nil, no default charset is assumed when posting."
 \f
 ;;; Internal variables
 
+(defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
 (defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
 (defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
 (defvar gnus-original-article-buffer " *Original Article*")
@@ -1482,6 +1513,9 @@ If nil, no default charset is assumed when posting."
 (defvar gnus-agent nil
   "Whether we want to use the Gnus agent or not.")
 
+(defvar gnus-agent-fetching nil
+  "Whether Gnus agent is in fetching mode.")
+
 (defvar gnus-command-method nil
   "Dynamically bound variable that says what the current backend is.")
 
@@ -1612,6 +1646,9 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
 
 (defvar gnus-dead-summary nil)
 
+(defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
+  "Regexp matching invalid groups.")
+
 ;;; End of variables.
 
 ;; Define some autoload functions Gnus might use.
@@ -1762,10 +1799,12 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
       gnus-article-delete-invisible-text gnus-treat-article)
      ("gnus-art" :interactive t
       gnus-article-hide-headers gnus-article-hide-boring-headers
-      gnus-article-treat-overstrike 
+      gnus-article-treat-overstrike
       gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
       gnus-article-display-x-face gnus-article-de-quoted-unreadable
+      gnus-article-de-base64-unreadable
       gnus-article-decode-HZ
+      gnus-article-wash-html
       gnus-article-hide-pgp
       gnus-article-hide-pem gnus-article-hide-signature
       gnus-article-strip-leading-blank-lines gnus-article-date-local
@@ -2633,9 +2672,21 @@ just the host name."
                group (substring group (+ 1 colon))))
        (setq foreign (concat foreign ":")))
       ;; Collapse group name leaving LEVELS uncollapsed elements
-      (let* ((glist (split-string group "\\."))
-            (glen (length glist))
+      (let* ((slist (split-string group "/"))
+            (slen (length slist))
+            (dlist (split-string group "\\."))
+            (dlen (length dlist))
+            glist
+            glen
+            gsep
             res)
+       (if (> slen dlen)
+           (setq glist slist
+                 glen slen
+                 gsep "/")
+         (setq glist dlist
+               glen dlen
+               gsep "."))
        (setq levels (- glen levels))
        (dolist (g glist)
          (push (if (>= (decf levels) 0)
@@ -2644,7 +2695,7 @@ just the host name."
                      (substring g 0 1))
                  g)
                res))
-       (concat foreign (mapconcat 'identity (nreverse res) "."))))))
+       (concat foreign (mapconcat 'identity (nreverse res) gsep))))))
 
 (defun gnus-narrow-to-body ()
   "Narrow to the body of an article."
@@ -2797,8 +2848,8 @@ Disallow invalid group names."
   (let ((prefix "")
        group)
     (while (not group)
-      (when (string-match
-            "[: `'\"/]\\|^$"
+      (when (string-match 
+            gnus-invalid-group-regexp
             (setq group (read-string (concat prefix prompt)
                                      (cons (or default "") 0)
                                      'gnus-group-history)))
@@ -2831,7 +2882,7 @@ Allow completion over sensible values."
        (or (let ((opened gnus-opened-servers))
              (while (and opened
                          (not (equal (format "%s:%s" method address)
-                                     (format "%s:%s" (caaar opened) 
+                                     (format "%s:%s" (caaar opened)
                                              (cadaar opened)))))
                (pop opened))
              (caar opened))
@@ -2879,7 +2930,7 @@ As opposed to `gnus', this command will not connect to the local server."
 
 ;;(setq thing ?                                ; this is a comment
 ;;      more 'yes)
-    
+
 ;;;###autoload
 (defun gnus (&optional arg dont-connect slave)
   "Read network news.