*** empty log message ***
[gnus] / lisp / gnus-art.el
index 26f5e60..7ea9d4f 100644 (file)
 
 ;;; Code:
 
-(require 'gnus-load)
+(require 'gnus)
 (require 'gnus-sum)
 (require 'article)
 (require 'gnus-spec)
 (require 'gnus-int)
+(require 'browse-url)
 
-(defvar gnus-article-save-directory gnus-directory
-  "*Name of the directory articles will be saved in (default \"~/News\").")
+(defcustom gnus-article-save-directory gnus-directory
+  "*Name of the directory articles will be saved in (default \"~/News\")."
+  :group 'article
+  :type 'directory)
 
-(defvar gnus-save-all-headers t
-  "*If non-nil, don't remove any headers before saving.")
+(defcustom gnus-save-all-headers t
+  "*If non-nil, don't remove any headers before saving."
+  :group 'article
+  :type 'boolean)
 
-(defvar gnus-prompt-before-saving 'always
+(defcustom gnus-prompt-before-saving 'always
   "*This variable says how much prompting is to be done when saving articles.
 If it is nil, no prompting will be done, and the articles will be
 saved to the default files.  If this variable is `always', each and
 every article that is saved will be preceded by a prompt, even when
 saving large batches of articles.  If this variable is neither nil not
 `always', there the user will be prompted once for a file name for
-each invocation of the saving commands.")
-
-(defvar gnus-saved-headers gnus-visible-headers
-  "*Headers to keep if `gnus-save-all-headers' is nil.
+each invocation of the saving commands."
+  :group 'article
+  :type '(choice (item always)
+                (item :tag "never" nil)
+                (sexp :tag "once" :format "%t")))
+
+(defcustom gnus-saved-headers gnus-visible-headers
+  "Headers to keep if `gnus-save-all-headers' is nil.
 If `gnus-save-all-headers' is non-nil, this variable will be ignored.
 If that variable is nil, however, all headers that match this regexp
-will be kept while the rest will be deleted before saving.")
+will be kept while the rest will be deleted before saving."
+  :group 'article
+  :type '(repeat string))
 
-(defvar gnus-default-article-saver 'gnus-summary-save-in-rmail
-  "*A function to save articles in your favorite format.
+(defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail
+  "A function to save articles in your favourite format.
 The function must be interactively callable (in other words, it must
 be an Emacs command).
 
@@ -62,29 +73,45 @@ Gnus provides the following functions:
 * gnus-summary-save-in-rmail (Rmail format)
 * gnus-summary-save-in-mail (Unix mail format)
 * gnus-summary-save-in-folder (MH folder)
-* gnus-summary-save-in-file (article format).
-* gnus-summary-save-in-vm (use VM's folder format).")
-
-(defvar gnus-rmail-save-name (function gnus-plain-save-name)
-  "*A function generating a file name to save articles in Rmail format.
-The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
-
-(defvar gnus-mail-save-name (function gnus-plain-save-name)
-  "*A function generating a file name to save articles in Unix mail format.
-The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
-
-(defvar gnus-folder-save-name (function gnus-folder-save-name)
-  "*A function generating a file name to save articles in MH folder.
-The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER.")
-
-(defvar gnus-file-save-name (function gnus-numeric-save-name)
-  "*A function generating a file name to save articles in article format.
+* gnus-summary-save-in-file (article format)
+* gnus-summary-save-in-vm (use VM's folder format)
+* gnus-summary-write-to-file (article format -- overwrite)."
+  :group 'article
+  :type '(radio (function-item gnus-summary-save-in-rmail)
+               (function-item gnus-summary-save-in-mail)
+               (function-item gnus-summary-save-in-folder)
+               (function-item gnus-summary-save-in-file)
+               (function-item gnus-summary-save-in-vm)
+               (function-item gnus-summary-write-to-file)))
+
+(defcustom gnus-rmail-save-name 'gnus-plain-save-name
+  "A function generating a file name to save articles in Rmail format.
+The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
+  :group 'article
+  :type 'function)
+
+(defcustom gnus-mail-save-name 'gnus-plain-save-name
+  "A function generating a file name to save articles in Unix mail format.
+The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
+  :group 'article
+  :type 'function)
+
+(defcustom gnus-folder-save-name 'gnus-folder-save-name
+  "A function generating a file name to save articles in MH folder.
+The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER."
+  :group 'article
+  :type 'function)
+
+(defcustom gnus-file-save-name 'gnus-numeric-save-name
+  "A function generating a file name to save articles in article format.
 The function is called with NEWSGROUP, HEADERS, and optional
-LAST-FILE.")
+LAST-FILE."
+  :group 'article
+  :type 'function)
 
-(defvar gnus-split-methods
+(defcustom gnus-split-methods
   '((gnus-article-archive-name))
-  "*Variable used to suggest where articles are to be saved.
+  "Variable used to suggest where articles are to be saved.
 For instance, if you would like to save articles related to Gnus in
 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
 you could set this variable to something like:
@@ -102,46 +129,167 @@ parameter.  If it is a list, it will be evaled in the same buffer.
 
 If this form or function returns a string, this string will be used as
 a possible file name; and if it returns a non-nil list, that list will
-be used as possible file names.")
-
-(defvar gnus-strict-mime t
-  "*If nil, MIME-decode even if there is no Mime-Version header in the article.")
-
-(defvar gnus-show-mime-method 'metamail-buffer
-  "*Function to process a MIME message.
-The function is called from the article buffer.")
-
-(defvar gnus-decode-encoded-word-method (lambda ())
+be used as possible file names."
+  :group 'article
+  :type '(repeat (choice (list function)
+                        (cons regexp (repeat string))
+                        sexp)))
+
+(defcustom gnus-strict-mime t
+  "*If nil, MIME-decode even if there is no Mime-Version header."
+  :group 'article
+  :type 'boolean)
+
+(defcustom gnus-show-mime-method 'metamail-buffer
+  "Function to process a MIME message.
+The function is called from the article buffer."
+  :group 'article
+  :type 'function)
+
+(defcustom gnus-decode-encoded-word-method (lambda ())
   "*Function to decode a MIME encoded-words.
-The function is called from the article buffer.")
+The function is called from the article buffer."
+  :group 'article
+  :type 'function)
 
-(defvar gnus-page-delimiter "^\^L"
+(defcustom gnus-page-delimiter "^\^L"
   "*Regexp describing what to use as article page delimiters.
 The default value is \"^\^L\", which is a form linefeed at the
-beginning of a line.")
+beginning of a line."
+  :type 'regexp
+  :group 'article)
 
-(defvar gnus-article-mode-line-format "Gnus: %%b %S"
+(defcustom gnus-article-mode-line-format "Gnus: %%b %S"
   "*The format specification for the article mode line.
-See `gnus-summary-mode-line-format' for a closer description.")
+See `gnus-summary-mode-line-format' for a closer description."
+  :type 'string
+  :group 'article)
 
-(defvar gnus-article-mode-hook nil
-  "*A hook for Gnus article mode.")
+(defcustom gnus-article-mode-hook nil
+  "*A hook for Gnus article mode."
+  :type 'hook
+  :group 'article)
 
-(defvar gnus-article-prepare-hook nil
+(defcustom gnus-article-menu-hook nil
+  "*Hook run after the creation of the article mode menu."
+  :type 'hook
+  :group 'article)
+
+(defcustom gnus-article-prepare-hook nil
   "*A hook called after an article has been prepared in the article buffer.
-If you want to run a special decoding program like nkf, use this hook.")
-
-;(defvar gnus-article-display-hook nil
-;  "*A hook called after the article is displayed in the article buffer.
-;The hook is designed to change the contents of the article
-;buffer.  Typical functions that this hook may contain are
-;`gnus-article-hide-headers' (hide selected headers),
-;`gnus-article-maybe-highlight' (perform fancy article highlighting),
-;`gnus-article-hide-signature' (hide signature) and
-;`gnus-article-treat-overstrike' (turn \"^H_\" into bold characters).")
-;(add-hook 'gnus-article-display-hook 'gnus-article-hide-headers-if-wanted)
-;(add-hook 'gnus-article-display-hook 'gnus-article-treat-overstrike)
-;(add-hook 'gnus-article-display-hook 'gnus-article-maybe-highlight)
+If you want to run a special decoding program like nkf, use this hook."
+  :type 'hook
+  :group 'article)
+
+(defcustom gnus-article-button-face 'bold
+  "Face used for highlighting buttons in the article buffer.
+
+An article button is a piece of text that you can activate by pressing
+`RET' or `mouse-2' above it."
+  :type 'face
+  :group 'article)
+
+(defcustom gnus-article-mouse-face 'highlight
+  "Face used for mouse highlighting in the article buffer.
+
+Article buttons will be displayed in this face when the cursor is
+above them."
+  :type 'face
+  :group 'article)
+
+(defcustom gnus-signature-face 'italic
+  "Face used for highlighting a signature in the article buffer."
+  :type 'face
+  :group 'article)
+
+(defface gnus-header-from-face 
+  '((((class color)
+      (background dark))
+     (:foreground "light blue" :bold t :italic t))
+    (((class color)
+      (background light))
+     (:foreground "MidnightBlue" :bold t :italic t))
+    (t 
+     (:bold t :italic t)))
+  "Face used for displaying from headers."
+  :group 'article)
+
+(defface gnus-header-subject-face 
+  '((((class color)
+      (background dark))
+     (:foreground "pink" :bold t :italic t))
+    (((class color)
+      (background light))
+     (:foreground "firebrick" :bold t :italic t))
+    (t 
+     (:bold t :italic t)))
+  "Face used for displaying subject headers."
+  :group 'article)
+
+(defface gnus-header-newsgroups-face 
+  '((((class color)
+      (background dark))
+     (:foreground "yellow" :bold t :italic t))
+    (((class color)
+      (background light))
+     (:foreground "indianred" :bold t :italic t))
+    (t 
+     (:bold t :italic t)))
+  "Face used for displaying newsgroups headers."
+  :group 'article)
+
+(defface gnus-header-name-face 
+  '((((class color)
+      (background dark))
+     (:foreground "cyan" :bold t))
+    (((class color)
+      (background light))
+     (:foreground "DarkGreen" :bold t))
+    (t 
+     (:bold t)))
+  "Face used for displaying header names."
+  :group 'article)
+
+(defface gnus-header-content-face
+  '((((class color)
+      (background dark))
+     (:foreground "forest green" :italic t))
+    (((class color)
+      (background light))
+     (:foreground "DarkGreen" :italic t))
+    (t 
+     (:italic t)))  "Face used for displaying header content."
+  :group 'article)
+
+(defcustom gnus-header-face-alist
+  '(("From" nil gnus-header-from-face)
+    ("Subject" nil gnus-header-subject-face)
+    ("Newsgroups:.*," nil gnus-header-newsgroups-face)
+    ("" gnus-header-name-face gnus-header-content-face))
+  "Controls highlighting of article header.
+
+An alist of the form (HEADER NAME CONTENT). 
+
+HEADER is a regular expression which should match the name of an
+header header and NAME and CONTENT are either face names or nil.
+
+The name of each header field will be displayed using the face
+specified by the first element in the list where HEADER match the
+header name and NAME is non-nil.  Similarly, the content will be
+displayed by the first non-nil matching CONTENT face."
+  :group 'article
+  :type '(repeat (list (regexp :tag "Header")
+                      (choice :tag "Name"
+                              (item :tag "skip" nil)
+                              (face :value default))
+                      (choice :tag "Content"
+                              (item :tag "skip" nil)
+                              (face :value default)))))
+
+(defvar gnus-article-mode-syntax-table
+  (copy-syntax-table text-mode-syntax-table)
+  "Syntax table used in article mode buffers.
+Initialized from `text-mode-syntax-table.")
 
 ;;; Internal variables
 
@@ -149,6 +297,8 @@ If you want to run a special decoding program like nkf, use this hook.")
     (nconc '((?w (gnus-article-wash-status) ?s))
           gnus-summary-mode-line-format-alist))
 
+(defvar gnus-number-of-articles-to-be-saved nil)
+
 ;;; Provide a mapping from `gnus-*' commands to Article commands.
 
 (eval-and-compile
@@ -174,14 +324,16 @@ If you want to run a special decoding program like nkf, use this hook.")
      article-treat-overstrike
      (article-fill . gnus-article-word-wrap)
      article-remove-cr
-     article-remove-trailing-blank-lines
      article-display-x-face
      article-de-quoted-unreadable
      article-mime-decode-quoted-printable
      article-hide-pgp
      article-hide-pem
      article-hide-signature
+     article-remove-trailing-blank-lines
      article-strip-leading-blank-lines
+     article-strip-multiple-blank-lines
+     article-strip-blank-lines
      article-date-local
      article-date-original
      article-date-lapsed
@@ -192,10 +344,10 @@ If you want to run a special decoding program like nkf, use this hook.")
 
 ;;; Saving functions.
 
-(defun gnus-article-save (save-buffer file)
+(defun gnus-article-save (save-buffer file &optional num)
   "Save the currently selected article."
   (unless gnus-save-all-headers
-    ;; Remove headers accoring to `gnus-saved-headers'.
+    ;; Remove headers according to `gnus-saved-headers'.