*** empty log message ***
[gnus] / lisp / gnus.el
index 42d690e..bbe72c3 100644 (file)
 
 (eval '(run-hooks 'gnus-load-hook))
 
-(defconst gnus-version-number "0.31"
+(require 'custom)
+
+(defgroup gnus nil
+  "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
+  :group 'emacs)
+
+(defgroup gnus-start nil
+  "Starting your favorite newsreader."
+  :group 'gnus)
+
+(defgroup gnus-score nil
+  "Score and kill file handling."
+  :group 'gnus )
+
+(defconst gnus-version-number "0.46"
   "Version number for this version of Gnus.")
 
 (defconst gnus-version (format "Red Gnus v%s" gnus-version-number)
   "Version string for this version of Gnus.")
 
-(defvar gnus-inhibit-startup-message nil
-  "*If non-nil, the startup message will not be displayed.")
+(defcustom gnus-inhibit-startup-message nil
+  "*If non-nil, the startup message will not be displayed."
+  :group 'gnus-start
+  :type 'boolean)
 
-(defvar gnus-play-startup-jingle nil
-  "If non-nil, play the Gnus jingle at startup.")
+(defcustom gnus-play-startup-jingle nil
+  "If non-nil, play the Gnus jingle at startup."
+  :group 'gnus-start
+  :type 'boolean)
+
+;;; Kludges to help the transition from the old `custom.el'.
+
+;; XEmacs and Emacs 19.29 facep does different things.
+(defalias 'custom-facep
+  (cond ((fboundp 'find-face)
+        'find-face)
+       ((fboundp 'facep)
+        'facep)
+       (t
+        'ignore)))
+
+;; The XEmacs people think this is evil, so it must go.
+(defun custom-face-lookup (&optional fg bg stipple bold italic underline)
+  "Lookup or create a face with specified attributes."
+  (let ((name (intern (format "custom-face-%s-%s-%s-%S-%S-%S"
+                             (or fg "default")
+                             (or bg "default")
+                             (or stipple "default")
+                             bold italic underline))))
+    (if (and (custom-facep name)
+            (fboundp 'make-face))
+       ()
+      (copy-face 'default name)
+      (when (and fg
+                (not (string-equal fg "default")))
+       (condition-case ()
+           (set-face-foreground name fg)
+         (error nil)))
+      (when (and bg
+                (not (string-equal bg "default")))
+       (condition-case ()
+           (set-face-background name bg)
+         (error nil)))
+      (when (and stipple
+                (not (string-equal stipple "default"))
+                (not (eq stipple 'custom:asis))
+                (fboundp 'set-face-stipple))
+       (set-face-stipple name stipple))
+      (when (and bold
+                (not (eq bold 'custom:asis)))
+       (condition-case ()
+           (make-face-bold name)
+         (error nil)))
+      (when (and italic
+                (not (eq italic 'custom:asis)))
+       (condition-case ()
+           (make-face-italic name)
+         (error nil)))
+      (when (and underline
+                (not (eq underline 'custom:asis)))
+       (condition-case ()
+           (set-face-underline-p name t)
+         (error nil))))
+    name))
 
 ;;; Internal variables
 
     (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
   ;; Fontify some.
   (goto-char (point-min))
-  (and (search-forward "Praxis" nil t)
-       (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
+  (when (search-forward "Praxis" nil t)
+    (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
   (goto-char (point-min))
   (setq mode-line-buffer-identification gnus-version)
   (set-buffer-modified-p t))
 
 ;;; Load the compatability functions.
 
-(require 'gnus-cus)
 (require 'gnus-ems)
 
 \f
 ;; Add the current buffer to the list of buffers to be killed on exit.
 (defun gnus-add-current-to-buffer-list ()
   (or (memq (current-buffer) gnus-buffer-list)
-      (setq gnus-buffer-list (cons (current-buffer) gnus-buffer-list))))
+      (push (current-buffer) gnus-buffer-list)))
 
 (defun gnus-version (&optional arg)
   "Version number of this version of Gnus.
@@ -522,13 +594,13 @@ that that variable is buffer-local to the summary buffers."
   (if (not method)
       group
     (concat (format "%s" (car method))
-           (if (and
-                (or (assoc (format "%s" (car method)) 
-                           (gnus-methods-using 'address))
-                    (gnus-server-equal method gnus-message-archive-method))
-                (nth 1 method)
-                (not (string= (nth 1 method) "")))
-               (concat "+" (nth 1 method)))
+           (when (and
+                  (or (assoc (format "%s" (car method))
+                             (gnus-methods-using 'address))
+                      (gnus-server-equal method gnus-message-archive-method))
+                  (nth 1 method)
+                  (not (string= (nth 1 method) "")))
+             (concat "+" (nth 1 method)))
            ":" group)))
 
 (defun gnus-group-real-prefix (group)
@@ -624,9 +696,9 @@ If SYMBOL, return the value of that symbol in the group parameters."
       (let ((old-params (gnus-info-params info))
            (new-params (list (cons name value))))
        (while old-params
-         (if (or (not (listp (car old-params)))
-                 (not (eq (caar old-params) name)))
-             (setq new-params (append new-params (list (car old-params)))))
+         (when (or (not (listp (car old-params)))
+                   (not (eq (caar old-params) name)))
+           (setq new-params (append new-params (list (car old-params)))))
          (setq old-params (cdr old-params)))
        (gnus-group-set-info new-params group 'params)))))
 
@@ -652,23 +724,24 @@ just the host name."
     ;; 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)
-       (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)))
-                ))))
+    (when (string-match ":" group)
+      (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 0))
@@ -699,11 +772,14 @@ Returns the number of articles marked as read."
     (when (get-file-buffer file)
       (save-excursion
        (set-buffer (get-file-buffer file))
-       (and (buffer-modified-p) (save-buffer))
+       (when (buffer-modified-p)
+         (save-buffer))
        (kill-buffer (current-buffer))))))
 
-(defvar gnus-kill-file-name "KILL"
-  "Suffix of the kill files.")
+(defcustom gnus-kill-file-name "KILL"
+  "Suffix of the kill files."
+  :group 'gnus-score
+  :type 'string)
 
 (defun gnus-newsgroup-kill-file (newsgroup)
   "Return the name of a kill file name for NEWSGROUP.
@@ -804,8 +880,8 @@ If NEWSGROUP is nil, return the global kill file name instead."
   (let ((valids gnus-valid-select-methods)
        outs)
     (while valids
-      (if (memq feature (car valids))
-         (setq outs (cons (car valids) outs)))
+      (when (memq feature (car valids))
+       (push (car valids) outs))
       (setq valids (cdr valids)))
     outs))