*** empty log message ***
[gnus] / lisp / gnus-cus.el
index 2607479..a560e2a 100644 (file)
 
 (require 'wid-edit)
 (require 'gnus-score)
+(require 'gnus-topic)
 
 ;;; Widgets:
 
-;; There should be special validation for this.  
+;; There should be special validation for this.
 (define-widget 'gnus-email-address 'string
   "An email address")
 
@@ -51,7 +52,7 @@ if that value is non-nil."
   (setq major-mode 'gnus-custom-mode
        mode-name "Gnus Customize")
   (use-local-map widget-keymap)
-  (run-hooks 'gnus-custom-mode-hook))
+  (gnus-run-hooks 'gnus-custom-mode-hook))
 
 ;;; Group Customization:
 
@@ -59,7 +60,7 @@ if that value is non-nil."
   '((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 
+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,
@@ -73,7 +74,7 @@ is therefore impossible--you have to send mail to the mailing list
 address instead.")
 
     (to-list (gnus-email-address :tag "To List") "\
-This address will be used when doing a `a' in the group. 
+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
@@ -88,7 +89,7 @@ listserv itself.  This is broken behavior.  So there!")
 
     (to-group (string :tag "To Group") "\
 All posts will be send to the specified group.")
-    
+
     (gcc-self (choice :tag  "GCC"
                      :value t
                      (const t)
@@ -103,13 +104,18 @@ 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 ) "\
+Banner to be removed from articles.")
+a
     (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.  
+This happens even if they are not marked as expirable.
 Use with caution.")
 
     (expiry-wait (choice :tag  "Expire Wait"
@@ -118,7 +124,7 @@ Use with caution.")
                         (const immediate)
                         (number :hide-front-space t
                                 :format "%v")) "\
-When to expire.  
+When to expire.
 
 Overrides any `nnmail-expiry-wait' and `nnmail-expiry-wait-function'
 when expiring expirable messages. The value can either be a number of
@@ -128,9 +134,9 @@ days (not necessarily an integer) or the symbols `never' or
     (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.")
-    
+
     (adapt-file (file :tag "Adapt File") "\
-Make the specified file into the current adaptive file.  
+Make the specified file into the current adaptive file.
 All adaptive score entries will be put into this file.")
 
     (admin-address (gnus-email-address :tag "Admin Address") "\
@@ -145,7 +151,7 @@ you to put the admin address somewhere convenient.")
                     :value default
                     (const all)
                     (const default)) "\
-Which articles to display on entering the group.  
+Which articles to display on entering the group.
 
 `all'
      Display all articles, both read and unread.
@@ -155,8 +161,15 @@ Which articles to display on entering the group.
      unread and ticked articles.")
 
     (comment (string :tag  "Comment") "\
-An arbitrary comment on the group."))
-  "Alist of valid group parameters.  
+An arbitrary comment on the group.")
+
+    (visible (const :tag "Permanently visible" t) "\
+Always display this group, even when there are no unread articles
+in it..")
+
+    (charset (string :tag "Charset") "\
+The default charset to use in the group."))
+  "Alist of valid 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
@@ -165,35 +178,44 @@ DOC is a documentation string for the parameter.")
 (defvar gnus-custom-params)
 (defvar gnus-custom-method)
 (defvar gnus-custom-group)
+(defvar gnus-custom-topic)
 
-(defun gnus-group-customize (group &optional part)
-  "Edit the group on the current line."
-  (interactive (list (gnus-group-group-name)))
-  (let ((part (or part 'info))
-       info
+(defun gnus-group-customize (group &optional topic)
+  "Edit the group or topic on the current line."
+  (interactive (list (gnus-group-group-name) (gnus-group-topic-name)))
+  (let (info
        (types (mapcar (lambda (entry)
                         `(cons :format "%v%h\n"
                                :doc ,(nth 2 entry)
                                (const :format "" ,(nth 0 entry))
                                ,(nth 1 entry)))
                       gnus-group-parameters)))
-    (unless group
+    (unless (or group topic)
       (error "No group on current line"))
-    (unless (setq info (gnus-get-info group))
+    (when (and group topic)
+      (error "Both a group an topic on current line"))
+    (unless (or topic (setq info (gnus-get-info group)))
       (error "Killed group; can't be edited"))
     ;; Ready.
-    (kill-buffer (get-buffer-create "*Gnus Customize*"))
-    (switch-to-buffer (get-buffer-create "*Gnus Customize*"))
+    (kill-buffer (gnus-get-buffer-create "*Gnus Customize*"))
+    (switch-to-buffer (gnus-get-buffer-create "*Gnus Customize*"))
     (gnus-custom-mode)
     (make-local-variable 'gnus-custom-group)
     (setq gnus-custom-group group)
+    (make-local-variable 'gnus-custom-topic)
+    (setq gnus-custom-topic topic)
     (widget-insert "Customize the ")
-    (widget-create 'info-link
-                  :help-echo "Push me to learn more."
-                  :tag "group parameters"
-                  "(gnus)Group Parameters")
+    (if group
+       (widget-create 'info-link
+                      :help-echo "Push me to learn more."
+                      :tag "group parameters"
+                      "(gnus)Group Parameters")
+      (widget-create 'info-link
+                    :help-echo "Push me to learn more."
+                    :tag  "topic parameters"
+                    "(gnus)Topic Parameters"))
     (widget-insert " for <")
-    (widget-insert group)
+    (widget-insert (or group topic))
     (widget-insert "> and press ")
     (widget-create 'push-button
                   :tag "done"
@@ -203,21 +225,23 @@ DOC is a documentation string for the parameter.")
     (make-local-variable 'gnus-custom-params)
     (setq gnus-custom-params
          (widget-create 'group
-                        :value (gnus-info-params info)
+                        :value (if group
+                                   (gnus-info-params info)
+                                 (gnus-topic-parameters topic))
                         `(set :inline t
                               :greedy t
                               :tag "Parameters"
                               :format "%t:\n%h%v"
                               :doc "\
 These special paramerters are recognized by Gnus.
-Check the [ ] for the parameters you want to apply to this group, then
-edit the value to suit your taste."
+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)
                         '(repeat :inline t
                                  :tag "Variables"
                                  :format "%t:\n%h%v%i\n\n"
                                  :doc "\
-Set variables local to the group you are entering.  
+Set variables local to the group you are entering.
 
 If you want to turn threading off in `news.answers', you could put
 `(gnus-show-threads nil)' in the group parameters of that group.
@@ -229,80 +253,84 @@ like.  If you want to hear a beep when you enter a group, you could
 put something like `(dummy-variable (ding))' in the parameters of that
 group.  `dummy-variable' will be set to the result of the `(ding)'
 form, but who cares?"
-                                 (group :value (nil nil)
+                                 (cons :format "%v" :value (nil .  nil)
                                         (symbol :tag "Variable")
                                         (sexp :tag
                                               "Value")))
-                        
+
                         '(repeat :inline t
                                  :tag "Unknown entries"
                                  sexp)))
-    (widget-insert "\n\nYou can also edit the ")
-    (widget-create 'info-link 
-                  :tag "select method"
-                  :help-echo "Push me to learn more about select methods."
-                  "(gnus)Select Methods")
-    (widget-insert " for the group.\n")
-    (setq gnus-custom-method 
-         (widget-create 'sexp 
-                        :tag "Method"
-                        :value (gnus-info-method info)))
+    (when group
+      (widget-insert "\n\nYou can also edit the ")
+      (widget-create 'info-link
+                    :tag "select method"
+                    :help-echo "Push me to learn more about select methods."
+                    "(gnus)Select Methods")
+      (widget-insert " for the group.\n")
+      (setq gnus-custom-method
+           (widget-create 'sexp
+                          :tag "Method"
+                          :value (gnus-info-method info))))
     (use-local-map widget-keymap)
     (widget-setup)))
 
 (defun gnus-group-customize-done (&rest ignore)
   "Apply changes and bury the buffer."
   (interactive)
-  (gnus-group-edit-group-done 'params gnus-custom-group 
-                             (widget-value gnus-custom-params))
-  (gnus-group-edit-group-done 'method gnus-custom-group 
-                             (widget-value gnus-custom-method))
+  (if gnus-custom-topic
+      (gnus-topic-set-parameters gnus-custom-topic
+                                (widget-value gnus-custom-params))
+    (gnus-group-edit-group-done 'params gnus-custom-group
+                               (widget-value gnus-custom-params))
+    (gnus-group-edit-group-done 'method gnus-custom-group
+                               (widget-value gnus-custom-method)))
   (bury-buffer))
 
 ;;; Score Customization:
 
 (defconst gnus-score-parameters
   '((mark (number :tag "Mark") "\
-The value of this entry should be a number. 
+The value of this entry should be a number.
 Any articles with a score lower than this number will be marked as read.")
 
     (expunge (number :tag "Expunge") "\
-The value of this entry should be a number.  
+The value of this entry should be a number.
 Any articles with a score lower than this number will be removed from
 the summary buffer.")
 
     (mark-and-expunge (number :tag "Mark-and-expunge") "\
-The value of this entry should be a number.  
+The value of this entry should be a number.
 Any articles with a score lower than this number will be marked as
 read and removed from the summary buffer.")
 
     (thread-mark-and-expunge (number :tag "Thread-mark-and-expunge") "\
-The value of this entry should be a number.  
+The value of this entry should be a number.
 All articles that belong to a thread that has a total score below this
 number will be marked as read and removed from the summary buffer.
 `gnus-thread-score-function' says how to compute the total score
 for a thread.")
 
-    (files (repeat :tag "Files" file) "\
-The value of this entry should be any number of file names.  
+    (files (repeat :inline t :tag "Files" file) "\
+The value of this entry should be any number of file names.
 These files are assumed to be score files as well, and will be loaded
 the same way this one was.")
 
-    (exclude-files (repeat :tag "Exclude-files" file) "\
-The clue of this entry should be any number of files.  
+    (exclude-files (repeat :inline t :tag "Exclude-files" file) "\
+The clue of this entry should be any number of files.
 These files will not be loaded, even though they would normally be so,
 for some reason or other.")
 
     (eval (sexp :tag "Eval" :value nil) "\
-The value of this entry will be `eval'el.  
+The value of this entry will be `eval'el.
 This element will be ignored when handling global score files.")
 
     (read-only (boolean :tag "Read-only" :value t) "\
-Read-only score files will not be updated or saved.  
+Read-only score files will not be updated or saved.
 Global score files should feature this atom.")
 
     (orphan (number :tag "Orphan") "\
-The value of this entry should be a number.  
+The value of this entry should be a number.
 Articles that do not have parents will get this number added to their
 scores.  Imagine you follow some high-volume newsgroup, like
 `comp.lang.c'.  Most likely you will only follow a few of the threads,
@@ -323,12 +351,12 @@ I.e.---the orphan score atom is for high-volume groups where there
 exist a few interesting threads which can't be found automatically
 by ordinary scoring rules.")
 
-    (adapt (choice :tag "Adapt" 
+    (adapt (choice :tag "Adapt"
                   (const t)
                   (const ignore)
                   (sexp :format "%v"
                         :hide-front-space t)) "\
-This entry controls the adaptive scoring.  
+This entry controls the adaptive scoring.
 If it is `t', the default adaptive scoring rules will be used.  If it
 is `ignore', no adaptive scoring will be performed on this group.  If
 it is a list, this list will be used as the adaptive scoring rules.
@@ -356,7 +384,7 @@ and set to the value specified.  This is a convenient, if somewhat
 strange, way of setting variables in some groups if you don't like
 hooks much.")
     (touched (sexp :format "Touched\n") "Internal variable."))
-  "Alist of valid symbolic score parameters.  
+  "Alist of valid symbolic score 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
@@ -395,14 +423,14 @@ documentation string for the parameter.")
                        (const :tag "default" nil)))
         (group `(group ,match ,score ,expire ,type))
         (doc (concat (or (widget-get widget :doc)
-                         (concat "Change score based on the " tag 
+                         (concat "Change score based on the " tag
                                  " header.\n"))
                      "
-You can have an arbitrary number of score entries for this header, 
+You can have an arbitrary number of score entries for this header,
 each score entry has four elements:
 
 1. The \"match element\".  This should be the string to look for in the
-   header. 
+   header.
 
 2. The \"score element\".  This number should be an integer in the
    neginf to posinf interval.  This number is added to the score
@@ -461,7 +489,7 @@ each score entry has four elements:
                        (const <=)))
         (group `(group ,match ,score ,expire ,type))
         (doc (concat (or (widget-get widget :doc)
-                         (concat "Change score based on the " tag 
+                         (concat "Change score based on the " tag
                                  " header.")))))
     (widget-put widget :args `(,item
                               (repeat :inline t
@@ -497,7 +525,7 @@ each score entry has four elements:
                        (const after)))
         (group `(group ,match ,score ,expire ,type))
         (doc (concat (or (widget-get widget :doc)
-                         (concat "Change score based on the " tag 
+                         (concat "Change score based on the " tag
                                  " header."))
                      "
 For the Date header we have three kinda silly match types: `before',
@@ -540,8 +568,8 @@ eh?")))
                         ,(nth 1 entry)))
               gnus-score-parameters)))
     ;; Ready.
-    (kill-buffer (get-buffer-create "*Gnus Customize*"))
-    (switch-to-buffer (get-buffer-create "*Gnus Customize*"))
+    (kill-buffer (gnus-get-buffer-create "*Gnus Customize*"))
+    (switch-to-buffer (gnus-get-buffer-create "*Gnus Customize*"))
     (gnus-custom-mode)
     (make-local-variable 'gnus-custom-score-alist)
     (setq gnus-custom-score-alist scores)
@@ -577,6 +605,7 @@ if you do all your changes will be lost.  ")
                                     (gnus-score-string :tag "Subject")
                                     (gnus-score-string :tag "References")
                                     (gnus-score-string :tag "Xref")
+                                    (gnus-score-string :tag "Extra")
                                     (gnus-score-string :tag "Message-ID")
                                     (gnus-score-integer :tag "Lines")
                                     (gnus-score-integer :tag "Chars")
@@ -643,8 +672,7 @@ articles in the thread.
   (bury-buffer))
 
 ;;; The End:
-         
+
 (provide 'gnus-cus)
 
 ;;; gnus-cus.el ends here
-