Import Oort Gnus v0.09.
[elisp/gnus.git-] / lisp / gnus-cus.el
index 92baaca..79f8dd1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; gnus-cus.el --- customization commands for Gnus
 ;;
-;; Copyright (C) 1996,1999 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: news
 ;;; Code:
 
 (require 'wid-edit)
+(require 'gnus)
 (require 'gnus-score)
 (require 'gnus-topic)
+(require 'gnus-art)
 
 ;;; Widgets:
 
-;; There should be special validation for this.
-(define-widget 'gnus-email-address 'string
-  "An email address")
-
 (defun gnus-custom-mode ()
   "Major mode for editing Gnus customization buffers.
 
@@ -52,41 +50,27 @@ if that value is non-nil."
   (setq major-mode 'gnus-custom-mode
        mode-name "Gnus Customize")
   (use-local-map widget-keymap)
+  ;; Emacs 21 stuff:
+  (when (and (facep 'custom-button-face)
+            (facep 'custom-button-pressed-face))
+    (set (make-local-variable 'widget-button-face)
+        'custom-button-face)
+    (set (make-local-variable 'widget-button-pressed-face)
+        'custom-button-pressed-face)
+    (set (make-local-variable 'widget-mouse-face)
+        'custom-button-pressed-face))
+  (when (and (boundp 'custom-raised-buttons)
+            (symbol-value 'custom-raised-buttons))
+    (set (make-local-variable 'widget-push-button-prefix) "")
+    (set (make-local-variable 'widget-push-button-suffix) "")
+    (set (make-local-variable 'widget-link-prefix) "")
+    (set (make-local-variable 'widget-link-suffix) ""))
   (gnus-run-hooks 'gnus-custom-mode-hook))
 
 ;;; Group Customization:
 
 (defconst gnus-group-parameters
-  '((to-address (gnus-email-address :tag "To Address") "\
-This will be used when doing followups and posts.
-
-This is primarily useful in mail groups that represent closed
-mailing lists--mailing lists where it's expected that everybody that
-writes to the mailing list is subscribed to it.  Since using this
-parameter ensures that the mail only goes to the mailing list itself,
-it means that members won't receive two copies of your followups.
-
-Using `to-address' will actually work whether the group is foreign or
-not.  Let's say there's a group on the server that is called
-`fa.4ad-l'.  This is a real newsgroup, but the server has gotten the
-articles from a mail-to-news gateway.  Posting directly to this group
-is therefore impossible--you have to send mail to the mailing list
-address instead.
-
-The gnus-group-split mail splitting mechanism will behave as if this
-address was listed in gnus-group-split Addresses (see below).")
-
-    (to-list (gnus-email-address :tag "To List") "\
-This address will be used when doing a `a' in the group.
-
-It is totally ignored when doing a followup--except that if it is
-present in a news group, you'll get mail group semantics when doing
-`f'.
-
-The gnus-group-split mail splitting mechanism will behave as if this
-address was listed in gnus-group-split Addresses (see below).")
-
-    (extra-aliases (choice
+  '((extra-aliases (choice
                    :tag "Extra Aliases"
                    (list
                     :tag "List"
@@ -137,11 +121,11 @@ listserv has inserted `Reply-To' headers that point back to the
 listserv itself.  This is broken behavior.  So there!")
 
     (to-group (string :tag "To Group") "\
-All posts will be send to the specified group.")
+All posts will be sent to the specified group.")
 
     (gcc-self (choice :tag  "GCC"
                      :value t
-                     (const t)
+                     (const :tag "To current group" t)
                      (const none)
                      (string :format "%v" :hide-front-space t)) "\
 Specify default value for GCC header.
@@ -153,21 +137,6 @@ is present and a string, this string will be inserted literally as a
 `gcc' header (this symbol takes precedence over any default `Gcc'
 rules as described later).")
 
-    (banner (choice :tag "Banner"
-                   (const signature)
-                   string
-                   (const :tag "None" nil)) "\
-Banner to be removed from articles.")
-
-    (auto-expire (const :tag "Automatic Expire" t) "\
-All articles that are read will be marked as expirable.")
-
-    (total-expire (const :tag "Total Expire" t) "\
-All read articles will be put through the expiry process
-
-This happens even if they are not marked as expirable.
-Use with caution.")
-
     (expiry-wait (choice :tag  "Expire Wait"
                         :value never
                         (const never)
@@ -181,6 +150,15 @@ when expiring expirable messages.  The value can either be a number of
 days (not necessarily an integer) or the symbols `never' or
 `immediate'.")
 
+    (expiry-target (choice :tag "Expiry Target"
+                          :value delete
+                          (const delete)
+                          (function :format "%v" nnmail-)
+                          string) "\
+Where expired messages end up.
+
+Overrides `nnmail-expiry-target', which see.")
+
     (score-file (file :tag "Score File") "\
 Make the specified file into the current score file.
 This means that all score commands you issue will end up in this file.")
@@ -200,15 +178,25 @@ you to put the admin address somewhere convenient.")
     (display (choice :tag "Display"
                     :value default
                     (const all)
-                    (const default)) "\
+                    (integer)
+                    (const default)
+                    (sexp  :tag "Other")) "\
 Which articles to display on entering the group.
 
 `all'
      Display all articles, both read and unread.
 
+`integer'
+     Display the last NUMBER articles in the group.  This is the same as
+     entering the group with C-u NUMBER.
+
 `default'
      Display the default visible articles, which normally includes
-     unread and ticked articles.")
+     unread and ticked articles.
+
+`Other'
+     Display the articles that satisfy the S-expression. The S-expression
+     should be in an array form.")
 
     (comment (string :tag  "Comment") "\
 An arbitrary comment on the group.")
@@ -217,28 +205,32 @@ An arbitrary comment on the group.")
 Always display this group, even when there are no unread articles
 in it..")
 
-    (charset (symbol :tag "Charset") "\
-The default charset to use in the group.")
-            
-    (ignored-charsets 
-     (choice :tag "Ignored charsets" 
-            :value nil
-            (repeat (symbol))) "\
-List of charsets that should be ignored.
-
-When these charsets are used in the \"charset\" parameter, the
-default charset will be used instead.")
-            
-    (highlight-words 
+    (highlight-words
      (choice :tag "Highlight words"
             :value nil
             (repeat (list (regexp :tag "Highlight regexp")
                           (number :tag "Group for entire word" 0)
                           (number :tag "Group for displayed part" 0)
-                          (symbol :tag "Face" 
+                          (symbol :tag "Face"
                                   gnus-emphasis-highlight-words))))
      "highlight regexps.
-See gnus-emphasis-alist."))
+See `gnus-emphasis-alist'.")
+
+    (posting-style
+     (choice :tag "Posting style"
+            :value nil
+            (repeat (list
+                     (choice :tag "Type"
+                             :value nil
+                             (const signature)
+                             (const signature-file)
+                             (const organization)
+                             (const address)
+                             (const name)
+                             (const body))
+                     (string :format "%v"))))
+     "post style.
+See `gnus-posting-styles'."))
   "Alist of valid group or topic parameters.
 
 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
@@ -247,16 +239,24 @@ DOC is a documentation string for the parameter.")
 
 (defconst gnus-extra-topic-parameters
   '((subscribe (regexp :tag "Subscribe") "\
-If `gnus-subscribe-newsgroup-method' is set to
+If `gnus-subscribe-newsgroup-method' or
+`gnus-subscribe-options-newsgroup-method' is set to
 `gnus-subscribe-topics', new groups that matches this regexp will
-automatically be subscribed to this topic")) 
+automatically be subscribed to this topic")
+    (subscribe-level (integer :tag "Subscribe Level" :value 1) "\
+If this topic parameter is set, when new groups are subscribed
+automatically under this topic (via the `subscribe' topic parameter)
+assign this level to the group, rather than the default level
+set in `gnus-level-default-subscribed'"))
   "Alist of topic parameters that are not also group parameters.
 
 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
 itself (a symbol), TYPE is the parameters type (a sexp widget), and
 DOC is a documentation string for the parameter.")
 
-(defconst gnus-extra-group-parameters nil
+(defconst gnus-extra-group-parameters
+  '((uidvalidity (string :tag "IMAP uidvalidity") "\
+Server-assigned value attached to IMAP groups, used to maintain consistency."))
   "Alist of group parameters that are not also topic parameters.
 
 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
@@ -276,7 +276,8 @@ DOC is a documentation string for the parameter.")
                                :doc ,(nth 2 entry)
                                (const :format "" ,(nth 0 entry))
                                ,(nth 1 entry)))
-                      (append gnus-group-parameters 
+                      (append (reverse gnus-group-parameters-more)
+                              gnus-group-parameters
                               (if group
                                   gnus-extra-group-parameters
                                 gnus-extra-topic-parameters)))))
@@ -294,6 +295,7 @@ DOC is a documentation string for the parameter.")
     (setq gnus-custom-group group)
     (make-local-variable 'gnus-custom-topic)
     (setq gnus-custom-topic topic)
+    (buffer-disable-undo)
     (widget-insert "Customize the ")
     (if group
        (widget-create 'info-link
@@ -305,7 +307,7 @@ DOC is a documentation string for the parameter.")
                     :tag  "topic parameters"
                     "(gnus)Topic Parameters"))
     (widget-insert " for <")
-    (widget-insert (or group topic))
+    (widget-insert (gnus-group-decoded-name (or group topic)))
     (widget-insert "> and press ")
     (widget-create 'push-button
                   :tag "done"
@@ -323,7 +325,7 @@ DOC is a documentation string for the parameter.")
                               :tag "Parameters"
                               :format "%t:\n%h%v"
                               :doc "\
-These special paramerters are recognized by Gnus.
+These special parameters are recognized by Gnus.
 Check the [ ] for the parameters you want to apply to this group or
 to the groups in this topic, then edit the value to suit your taste."
                               ,@types)
@@ -364,6 +366,7 @@ form, but who cares?"
                           :value (gnus-info-method info))))
     (use-local-map widget-keymap)
     (widget-setup)
+    (buffer-enable-undo)
     (goto-char (point-min))))
 
 (defun gnus-group-customize-done (&rest ignore)
@@ -649,8 +652,13 @@ eh?")))
 (defvar gnus-custom-score-alist)
 
 (defun gnus-score-customize (file)
-  "Customize score file FILE."
+  "Customize score file FILE.
+When called interactively, FILE defaults to the current score file.
+This can be changed using the `\\[gnus-score-change-score-file]' command."
   (interactive (list gnus-current-score-file))
+  (unless file
+    (error (format "No score file for %s"
+                  (gnus-group-decoded-name gnus-newsgroup-name))))
   (let ((scores (gnus-score-load file))
        (types (mapcar (lambda (entry)
                         `(group :format "%v%h\n"