*** empty log message ***
[gnus] / lisp / gnus-vis.el
index 610dd27..00aac60 100644 (file)
 
 (require 'gnus)
 (require 'gnus-ems)
-(require gnus-easymenu)
+(require 'easymenu)
 (require 'custom)
+(require 'browse-url)
+(eval-when-compile (require 'cl))
 
 (defvar gnus-group-menu-hook nil
   "*Hook run after the creation of the group mode menu.")
 ;(defvar gnus-signature-face 'italic
 ;  "Face used for signature.")
 
+(defvar gnus-button-url-regexp "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]"
+  "*Regular expression that matches URLs.")
+
 (defvar gnus-button-alist 
-  '(("in\\( +article\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2 
-     (assq (count-lines (point-min) (match-end 0)) 
-          gnus-cite-attribution-alist)
+  `(("\\bin\\( +article\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2 
+     (let ((lines (count-lines (point-min) (match-end 0))))
+       (or (assq lines gnus-cite-attribution-alist)
+          (assq (1+ lines) gnus-cite-attribution-alist)))
      gnus-button-message-id 3)
     ;; This is how URLs _should_ be embedded in text...
     ("<URL:\\([^\n\r>]*\\)>" 0 t gnus-button-url 1)
     ;; Next regexp stolen from highlight-headers.el.
     ;; Modified by Vladimir Alexiev.
-    ("\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]" 0 t gnus-button-url 0))
-  "Alist of regexps matching buttons in an article.
+    (,gnus-button-url-regexp 0 t gnus-button-url 0)
+    ("\\(<\\(url: \\)?news:\\([^>\n ]*\\)>\\)" 1 t
+     gnus-button-message-id 3)
+    ("\\(<URL: *\\)?mailto: *\\([^ \n\t]+\\)>?" 0 t gnus-button-reply 2)
+    )
+  "Alist of regexps matching buttons in article bodies.
 
 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
 REGEXP: is the string matching text around the button,
@@ -233,26 +243,27 @@ PAR: is a number of a regexp grouping whose text will be passed to CALLBACK.
 CALLBACK can also be a variable, in that case the value of that
 variable it the real callback function.")
 
+(defvar gnus-header-button-alist 
+  `(("^\\(References\\|Message-I[Dd]\\):" "<[^>]+>"
+     0 t gnus-button-message-id 0)
+    ("^\\(From\\|Reply-To\\): " ": *\\(.+\\)$" 1 t gnus-button-reply 0)
+    ("^\\(Cc\\|To\\):" "[^ \t\n<>,()\"]+@[^ \t\n<>,()\"]+" 
+     0 t gnus-button-mailto 0)
+    ("^X-[Uu][Rr][Ll]:" ,gnus-button-url-regexp 0 t gnus-button-url 0))
+  "Alist of headers and regexps to match buttons in article heads.
+
+This alist is very similar to `gnus-button-alist', except that each
+alist has an additional HEADER element first in each entry:
+
+\(HEADER REGEXP BUTTON FORM CALLBACK PAR)
+
+HEADER is a regexp to match a header.  For a fuller explanation, see
+`gnus-button-alist'.")
+
 ;see gnus-cus.el
 ;(eval-when-compile
 ;  (defvar browse-url-browser-function))
 
-;see gnus-cus.el
-;(defvar gnus-button-url
-;  (cond ((boundp 'browse-url-browser-function) browse-url-browser-function)
-;      ((fboundp 'w3-fetch) 'w3-fetch)
-;      ((eq window-system 'x) 'gnus-netscape-open-url))
-;  "*Function to fetch URL.
-;The function will be called with one argument, the URL to fetch.
-;Useful values of this function are:
-
-;w3-fetch: 
-;   defined in the w3 emacs package by William M. Perry.
-;gnus-netscape-open-url:
-;   open url in existing netscape, start netscape if none found.
-;gnus-netscape-start-url:
-;   start new netscape with url.")
-
 \f
 
 (eval-and-compile
@@ -275,13 +286,11 @@ variable it the real callback function.")
    (boundp 'gnus-group-reading-menu)
    (progn
      (easy-menu-define
-      gnus-group-reading-menu
-      gnus-group-mode-map
-      ""
+      gnus-group-reading-menu gnus-group-mode-map ""
       '("Group"
        ["Read" gnus-group-read-group t]
        ["Select" gnus-group-select-group t]
-       ["See old articles" gnus-group-select-group-all t]
+       ["See old articles" (gnus-group-select-group 'all) :keys "C-u SPC" ]
        ["Catch up" gnus-group-catchup-current t]
        ["Catch up all articles" gnus-group-catchup-current-all t]
        ["Check for new articles" gnus-group-get-new-news-this-group t]
@@ -293,12 +302,11 @@ variable it the real callback function.")
        ["Edit kill file" gnus-group-edit-local-kill t]
        ["Expire articles" gnus-group-expire-articles t]
        ["Set group level" gnus-group-set-current-level t]
+       ["Select quick" gnus-group-quick-select-group t]
        ))
   
      (easy-menu-define
-      gnus-group-group-menu
-      gnus-group-mode-map
-      ""
+      gnus-group-group-menu gnus-group-mode-map ""
       '("Groups"
        ("Listing"
         ["List subscribed groups" gnus-group-list-groups t]
@@ -309,7 +317,8 @@ variable it the real callback function.")
         ["Describe all groups" gnus-group-describe-all-groups t]
         ["Group apropos" gnus-group-apropos t]
         ["Group and description apropos" gnus-group-description-apropos t]
-        ["List groups matching..." gnus-group-list-matching t])
+        ["List groups matching..." gnus-group-list-matching t]
+        ["List active file" gnus-group-list-active t])
        ("Mark"
         ["Mark group" gnus-group-mark-group t]
         ["Unmark group" gnus-group-unmark-group t]
@@ -326,20 +335,22 @@ variable it the real callback function.")
         ["Make a doc group" gnus-group-make-doc-group t]
         ["Make a kiboze group" gnus-group-make-kiboze-group t]
         ["Make a virtual group" gnus-group-make-empty-virtual t]
-        ["Add a group to a virtual" gnus-group-add-to-virtual t])
+        ["Add a group to a virtual" gnus-group-add-to-virtual t]
+        ["Rename group" gnus-group-rename-group t]
+        ["Delete group" gnus-group-delete-group t])
        ("Editing groups"
         ["Parameters" gnus-group-edit-group-parameters t]
         ["Select method" gnus-group-edit-group-method t]
         ["Info" gnus-group-edit-group t])
+       ("Score file"
+        ["Flush cache" gnus-score-flush-cache t])
        ["Read a directory as a group" gnus-group-enter-directory t]
        ["Jump to group" gnus-group-jump-to-group t]
        ["Best unread group" gnus-group-best-unread-group t]
        ))
 
      (easy-menu-define
-      gnus-group-misc-menu
-      gnus-group-mode-map
-      ""
+      gnus-group-misc-menu gnus-group-mode-map ""
       '("Misc"
        ["Send a bug report" gnus-bug t]
        ["Send a mail" gnus-group-mail t]
@@ -367,6 +378,8 @@ variable it the real callback function.")
      (run-hooks 'gnus-group-menu-hook)
      )))
 
+(defvar gnus-server-mode-map)
+
 ;; Server mode
 (defun gnus-server-make-menu-bar ()
   (gnus-visual-turn-off-edit-menu 'server)
@@ -374,9 +387,7 @@ variable it the real callback function.")
    (boundp 'gnus-server-menu)
    (progn
      (easy-menu-define
-      gnus-server-menu
-      gnus-server-mode-map
-      ""
+      gnus-server-menu gnus-server-mode-map ""
       '("Server"
        ["Add" gnus-server-add-server t]
        ["Browse" gnus-server-read-server t]
@@ -387,8 +398,17 @@ variable it the real callback function.")
        ["Edit" gnus-server-edit-server t]
        ["Exit" gnus-server-exit t]
        ))
-     (run-hooks 'gnus-server-menu-hook)
-     )))
+
+     (easy-menu-define
+      gnus-server-menu gnus-server-mode-map ""
+      '("Connections"
+       ["Open" gnus-server-open-server t]
+       ["Close" gnus-server-close-server t]
+       ["Deny" gnus-server-deny-servers t]
+       ["Reset" gnus-server-remove-denials t]
+       ))
+
+     (run-hooks 'gnus-server-menu-hook))))
 
 ;; Browse mode
 (defun gnus-browse-make-menu-bar ()
@@ -397,16 +417,13 @@ variable it the real callback function.")
    (boundp 'gnus-browse-menu)
    (progn
      (easy-menu-define
-      gnus-browse-menu
-      gnus-browse-mode-map
-      ""
+      gnus-browse-menu gnus-browse-mode-map ""
       '("Browse"
        ["Subscribe" gnus-browse-unsubscribe-current-group t]
        ["Read" gnus-group-read-group t]
        ["Exit" gnus-browse-exit t]
        ))
-      (run-hooks 'gnus-browse-menu-hook)
-      )))
+      (run-hooks 'gnus-browse-menu-hook))))
 
 
 ;; Summary buffer
@@ -418,9 +435,7 @@ variable it the real callback function.")
    (progn
 
      (easy-menu-define
-      gnus-summary-misc-menu
-      gnus-summary-mode-map
-      ""
+      gnus-summary-misc-menu gnus-summary-mode-map ""
       '("Misc"
        ("Mark"
         ("Read"
@@ -438,12 +453,16 @@ variable it the real callback function.")
          ["Set expirable mark" gnus-summary-mark-as-expirable t]
          ["Set bookmark" gnus-summary-set-bookmark t]
          ["Remove bookmark" gnus-summary-remove-bookmark t])
-        ("Display"
-         ["Remove lines marked as read" gnus-summary-remove-lines-marked-as-read t]
-         ["Remove lines marked with..." gnus-summary-remove-lines-marked-with t]
-         ["Show dormant articles" gnus-summary-show-all-dormant t]
-         ["Hide dormant articles" gnus-summary-hide-all-dormant t]
-         ["Show expunged articles" gnus-summary-show-all-expunged t])
+        ("Limit"
+         ["Unread" gnus-summary-limit-to-unread t]
+         ["Marks" gnus-summary-limit-to-marks t]
+         ["Score" gnus-summary-limit-to-score t]
+         ["Subject" gnus-summary-limit-to-subject t]
+         ["Non-dormant" gnus-summary-limit-exclude-dormant t]
+         ["Articles" gnus-summary-limit-to-articles t]
+         ["Pop limit" gnus-summary-pop-limit t]
+         ["Show dormant" gnus-summary-limit-include-dormant t]
+         ["Show expunged" gnus-summary-show-all-expunged t])
         ("Process mark"
          ["Set mark" gnus-summary-mark-as-processable t]
          ["Remove mark" gnus-summary-unmark-as-processable t]
@@ -452,8 +471,10 @@ variable it the real callback function.")
          ["Mark region" gnus-uu-mark-region t]
          ["Mark by regexp" gnus-uu-mark-by-regexp t]
          ["Mark all" gnus-uu-mark-all t]
+         ["Mark buffer" gnus-uu-mark-buffer t]
          ["Mark sparse" gnus-uu-mark-sparse t]
-         ["Mark thread" gnus-uu-mark-thread t]))
+         ["Mark thread" gnus-uu-mark-thread t]
+         ["Unmark thread" gnus-uu-unmark-thread t]))
        ("Move"
         ["Scroll article forwards" gnus-summary-next-page t]
         ["Next unread article" gnus-summary-next-unread-article t]
@@ -488,9 +509,7 @@ variable it the real callback function.")
        ))
 
      (easy-menu-define
-      gnus-summary-kill-menu
-      gnus-summary-mode-map
-      ""
+      gnus-summary-kill-menu gnus-summary-mode-map ""
       (cons
        "Score"
        (nconc
@@ -621,15 +640,14 @@ variable it the real callback function.")
            ))
 
      (easy-menu-define
-      gnus-summary-article-menu
-      gnus-summary-mode-map
-      ""
+      gnus-summary-article-menu gnus-summary-mode-map ""
       '("Article"
        ("Hide"
         ["All" gnus-article-hide t]
         ["Headers" gnus-article-hide-headers t]
         ["Signature" gnus-article-hide-signature t]
-        ["Citation" gnus-article-hide-citation t])
+        ["Citation" gnus-article-hide-citation t]
+        ["PGP" gnus-article-hide-pgp t])
        ("Highlight"
         ["All" gnus-article-highlight t]
         ["Headers" gnus-article-highlight-headers t]
@@ -638,6 +656,7 @@ variable it the real callback function.")
        ("Date"
         ["Local" gnus-article-date-local t]
         ["UT" gnus-article-date-ut t]
+        ["Original" gnus-article-date-original t]
         ["Lapsed" gnus-article-date-lapsed t])
        ("Filter"
         ["Overstrike" gnus-article-treat-overstrike t]
@@ -647,6 +666,7 @@ variable it the real callback function.")
         ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
         ["Rot 13" gnus-summary-caesar-message t]
         ["Add buttons" gnus-article-add-buttons t]
+        ["Add buttons to head" gnus-article-add-buttons-to-head t]
         ["Stop page breaking" gnus-summary-stop-page-breaking t]
         ["Toggle MIME" gnus-summary-toggle-mime t]
         ["Toggle header" gnus-summary-toggle-header t])
@@ -657,6 +677,7 @@ variable it the real callback function.")
         ["Save in MH folder" gnus-summary-save-article-folder t]
         ["Save in VM folder" gnus-summary-save-article-vm t]
         ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
+        ["Save body in file" gnus-summary-save-article-body-file t]
         ["Pipe through a filter" gnus-summary-pipe-output t])
        ("Backend"
         ["Respool article" gnus-summary-respool-article t]
@@ -678,15 +699,14 @@ variable it the real callback function.")
        ["Beginning of the article" gnus-summary-beginning-of-article t]
        ["End of the article" gnus-summary-end-of-article t]
        ["Fetch parent of article" gnus-summary-refer-parent-article t]
+       ["Fetch referenced articles" gnus-summary-refer-references t]
        ["Fetch article with id..." gnus-summary-refer-article t]
        ["Redisplay" gnus-summary-show-article t]))
 
 
         
      (easy-menu-define
-      gnus-summary-thread-menu
-      gnus-summary-mode-map
-      ""
+      gnus-summary-thread-menu gnus-summary-mode-map ""
       '("Threads"
        ["Toggle threading" gnus-summary-toggle-threads t]
        ["Display hidden thread" gnus-summary-show-thread t]
@@ -699,10 +719,9 @@ variable it the real callback function.")
        ["Lower thread score" gnus-summary-lower-thread t]
        ["Raise thread score" gnus-summary-raise-thread t]
        ))
+
      (easy-menu-define
-      gnus-summary-post-menu
-      gnus-summary-mode-map
-      ""
+      gnus-summary-post-menu gnus-summary-mode-map ""
       '("Post"
        ["Post an article" gnus-summary-post-news t]
        ["Followup" gnus-summary-followup t]
@@ -719,6 +738,9 @@ variable it the real callback function.")
        ["Reply & followup" gnus-summary-followup-and-reply t]
        ["Reply & followup and yank" gnus-summary-followup-and-reply-with-original t]
        ["Uuencode and post" gnus-uu-post-news t]
+       ("Draft"
+        ["Send" gnus-summary-send-draft t]
+        ["Send bounced" gnus-resend-bounced-mail t])
        ))
      (run-hooks 'gnus-summary-menu-hook)
      )))
@@ -871,9 +893,7 @@ If nil, the user will be asked for a duration.")
    (boundp 'gnus-article-article-menu)
    (progn
      (easy-menu-define
-      gnus-article-article-menu
-      gnus-article-mode-map
-      ""
+      gnus-article-article-menu gnus-article-mode-map ""
       '("Article"
        ["Scroll forwards" gnus-article-next-page t]
        ["Scroll backwards" gnus-article-prev-page t]
@@ -883,9 +903,7 @@ If nil, the user will be asked for a duration.")
        ))
 
      (easy-menu-define
-      gnus-article-treatment-menu
-      gnus-article-mode-map
-      ""
+      gnus-article-treatment-menu gnus-article-mode-map ""
       '("Treatment"
        ["Hide headers" gnus-article-hide-headers t]
        ["Hide signature" gnus-article-hide-signature t]
@@ -894,8 +912,7 @@ If nil, the user will be asked for a duration.")
        ["Remove carriage return" gnus-article-remove-cr t]
        ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]
        ))
-     (run-hooks 'gnus-article-menu-hook)
-     )))
+     (run-hooks 'gnus-article-menu-hook))))
 
 ;;;
 ;;; summary highlights
@@ -909,13 +926,13 @@ If nil, the user will be asked for a duration.")
        (let* ((beg (progn (beginning-of-line) (point)))
               (end (progn (end-of-line) (point)))
               ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
-              (from (if (get-text-property beg 'mouse-face
+              (from (if (get-text-property beg gnus-mouse-face-prop
                         beg
                       (1+ (or (next-single-property-change 
-                               beg 'mouse-face nil end) 
+                               beg gnus-mouse-face-prop nil end) 
                               beg))))
               (to (1- (or (next-single-property-change
-                           from 'mouse-face nil end)
+                           from gnus-mouse-face-prop nil end)
                           end))))
          ;; If no mouse-face prop on line (e.g. xemacs) we 
          ;; will have to = from = end, so we highlight the
@@ -939,17 +956,17 @@ If nil, the user will be asked for a duration.")
         (end (progn (end-of-line) (point)))
         ;; now find out where the line starts and leave point there.
         (beg (progn (beginning-of-line) (point)))
-        (score (or (cdr (assq (or (get-text-property beg 'gnus-number)
-                                  gnus-current-article)
+        (article (gnus-summary-article-number))
+        (score (or (cdr (assq (or article gnus-current-article)
                               gnus-newsgroup-scored))
                    gnus-summary-default-score 0))
         (default gnus-summary-default-score)
-        (mark (get-text-property beg 'gnus-mark))
+        (mark (or (gnus-summary-article-mark) gnus-unread-mark))
         (inhibit-read-only t))
     (while (and list (not (eval (car (car list)))))
       (setq list (cdr list)))
     (let ((face (and list (cdr (car list)))))
-      (or (eobp)
+      (or (null mark)
          (eq face (get-text-property beg 'face))
          (put-text-property beg end 'face 
                             (if (boundp face) (symbol-value face) face))))
@@ -964,9 +981,9 @@ If nil, the user will be asked for a duration.")
     ("prev" . gnus-group-prev-unread-group)
     ("read" . gnus-group-read-group)
     ("select" . gnus-group-select-group)
-    ("catch up" . gnus-group-catchup-current)
-    ("new news" . gnus-group-get-new-news-this-group)
-    ("toggle sub" . gnus-group-unsubscribe-current-group)
+    ("catch-up" . gnus-group-catchup-current)
+    ("new-news" . gnus-group-get-new-news-this-group)
+    ("toggle-sub" . gnus-group-unsubscribe-current-group)
     ("subscribe" . gnus-group-unsubscribe-group)
     ("kill" . gnus-group-kill-group)
     ("yank" . gnus-group-yank-group)
@@ -980,7 +997,7 @@ If nil, the user will be asked for a duration.")
     ("post" . gnus-group-post-news)
     ("mail" . gnus-group-mail)
     ("rescan" . gnus-group-get-new-news)
-    ("browse foreign" . gnus-group-browse-foreign)
+    ("browse-foreign" . gnus-group-browse-foreign)
     ("exit" . gnus-group-exit)))
 
 (defvar gnus-carpal-summary-buffer-buttons
@@ -991,15 +1008,15 @@ If nil, the user will be asked for a duration.")
     ("expirable" . gnus-summary-mark-as-expirable)
     "move"
     ("scroll" . gnus-summary-next-page)
-    ("next unread" . gnus-summary-next-unread-article)
-    ("prev unread" . gnus-summary-prev-unread-article)
+    ("next-unread" . gnus-summary-next-unread-article)
+    ("prev-unread" . gnus-summary-prev-unread-article)
     ("first" . gnus-summary-first-unread-article)
     ("best" . gnus-summary-best-unread-article)
     "article"
     ("headers" . gnus-summary-toggle-header)
     ("uudecode" . gnus-uu-decode-uu)
-    ("enter digest" . gnus-summary-enter-digest-group)
-    ("fetch parent" . gnus-summary-refer-parent-article)
+    ("enter-digest" . gnus-summary-enter-digest-group)
+    ("fetch-parent" . gnus-summary-refer-parent-article)
     "mail"
     ("move" . gnus-summary-move-article)
     ("copy" . gnus-summary-copy-article)
@@ -1015,7 +1032,7 @@ If nil, the user will be asked for a duration.")
     ("cancel" . gnus-summary-cancel-article)
     "misc"
     ("exit" . gnus-summary-exit)
-    ("fed up" . gnus-summary-catchup-and-goto-next-group)))
+    ("fed-up" . gnus-summary-catchup-and-goto-next-group)))
 
 (defvar gnus-carpal-server-buffer-buttons 
   '(("add" . gnus-server-add-server)
@@ -1105,7 +1122,7 @@ The following commands are available:
               (prog2 (insert (car button)) (point) (insert " "))
               (list 'gnus-callback (cdr button)
                     'face gnus-carpal-button-face
-                    'mouse-face 'highlight))))
+                    gnus-mouse-face-prop 'highlight))))
          (let ((fill-column (- (window-width) 2)))
            (fill-region (point-min) (point-max)))
          (set-window-point (get-buffer-window (current-buffer)) 
@@ -1162,20 +1179,31 @@ call it with the value of the `gnus-data' text property."
         (fun (get-text-property (point) 'gnus-callback)))
     (if fun (funcall fun data))))
 
-;; Suggested by Arne Elofsson <arne@hodgkin.mbi.ucla.edu>
-(defun gnus-article-next-button ()
-  "Move point to next button."
-  (interactive)
-  (if (get-text-property (point) 'gnus-callback)
-      (goto-char (next-single-property-change (point) 'gnus-callback
-                                             nil (point-max))))
-  (let ((pos (next-single-property-change (point) 'gnus-callback)))
-    (if pos
-       (goto-char pos)
-      (setq pos (next-single-property-change (point-min) 'gnus-callback))
-      (if pos
-         (goto-char pos)
-       (error "No buttons found")))))
+(defun gnus-article-prev-button (n)
+  "Move point to N buttons backward.
+If N is negative, move forward instead."
+  (interactive "p")
+  (gnus-article-next-button (- n)))
+
+(defun gnus-article-next-button (n)
+  "Move point to N buttons forward.
+If N is negative, move backward instead."
+  (interactive "p")
+  (let ((function (if (< n 0) 'prev-single-property-change
+                   'next-single-property-change))
+       (limit (if (< n 0) (point-min) (point-max))))
+    (setq n (abs n))
+    (while (and (not (= limit (point)))
+               (> n 0))
+      ;; Skip past the current button.
+      (when (get-text-property (point) 'gnus-callback)
+       (goto-char (funcall function (point) 'gnus-callback nil limit)))
+      ;; Go to the next (or previous) button.
+      (funcall function (point) 'gnus-callback nil limit)
+      (decf n))
+    (unless (zerop n)
+      (gnus-message 5 "No more buttons"))
+    n))
 
 (defun gnus-article-highlight (&optional force)
   "Highlight current article.
@@ -1187,7 +1215,8 @@ do the highlighting.  See the documentation for those functions."
   (gnus-article-highlight-headers)
   (gnus-article-highlight-citation force)
   (gnus-article-highlight-signature)
-  (gnus-article-add-buttons force))
+  (gnus-article-add-buttons force)
+  (gnus-article-add-buttons-to-head))
 
 (defun gnus-article-highlight-some (&optional force)
   "Highlight current article.
@@ -1248,7 +1277,7 @@ to do the hiding.  See the documentation for those functions."
                         (skip-chars-forward ": \t")
                         (let ((from (point)))
                           (goto-char end)
-                          (skip-chars-backward " \t")
+                          (skip-chars-backward " \t\n")
                           (put-text-property from (point) 'face field-face)
                           (setq field-found t))))))
            (goto-char begin)))))))
@@ -1285,53 +1314,84 @@ It does this by making everything after `gnus-signature-separator' invisible."
                                gnus-hidden-properties)))))
 
 (defun gnus-article-add-buttons (&optional force)
-  "Find external references in article and make them to buttons.
-
-External references are things like message-ids and URLs, as specified by 
-`gnus-button-alist'."
+  "Find external references in the article and make buttons of them.
+\"External references\" are things like Message-IDs and URLs, as
+specified by `gnus-button-alist'."
   (interactive (list 'force))
-  (if (eq gnus-button-last gnus-button-alist)
-      ()
+  (unless (eq gnus-button-last gnus-button-alist)
     (setq gnus-button-regexp (mapconcat 'car gnus-button-alist  "\\|")
          gnus-button-last gnus-button-alist))
   (save-excursion
     (set-buffer gnus-article-buffer)
+    ;; We parse citations first to be able to match attributions.
     (gnus-cite-parse-maybe force)
     (let ((buffer-read-only nil)
          (inhibit-point-motion-hooks t)
          (case-fold-search t))
       (goto-char (point-min))
-      (or (search-forward "\n\n" nil t)
-         (goto-char (point-max)))
+      ;; We skip the headers.
+      (unless (search-forward "\n\n" nil t)
+       (goto-char (point-max)))
+      ;; Then we search forward using that big regexp we have.
       (while (re-search-forward gnus-button-regexp nil t)
        (goto-char (match-beginning 0))
        (let* ((from (point))
-              (entry (gnus-button-entry))
+              (current (match-end 0))
+              (entry (gnus-button-entry)) ; Find sub-regexp.
               (start (and entry (match-beginning (nth 1 entry))))
               (end (and entry (match-end (nth 1 entry))))
               (form (nth 2 entry)))
-         (if (not entry)
-             ()
-           (goto-char (match-end 0))
-           (if (eval form)
-               (gnus-article-add-button start end 'gnus-button-push
-                                        (set-marker (make-marker)
-                                                    from)))))))))
-(defun gnus-netscape-open-url (url)
-  "Open URL in netscape, or start new scape with URL."
-  (let ((process (start-process (concat "netscape " url)
-                               nil
-                               "netscape"
-                               "-remote" 
-                               (concat "openUrl(" url ")'"))))
-    (set-process-sentinel process 
-                         (` (lambda (process change)
-                              (or (eq (process-exit-status process) 0)
-                                  (gnus-netscape-start-url (, url))))))))
-
-(defun gnus-netscape-start-url (url)
-  "Start netscape with URL."
-  (start-process (concat "netscape" url) nil "netscape" url))
+         ;; We now have a valid entry.
+         (when entry
+           (goto-char current)
+           (when (eval form)
+             ;; That optional form returned non-nil, so we add the
+             ;; button. 
+             (gnus-article-add-button 
+              start end 'gnus-button-push 
+              (set-marker (make-marker) from)))))))))
+
+;; Add buttons to the head of an article.
+(defun gnus-article-add-buttons-to-head ()
+  "Add buttons to the head of the article."
+  (interactive)
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (let ((buffer-read-only nil)
+         (inhibit-point-motion-hooks t)
+         (case-fold-search t)
+         (alist gnus-header-button-alist)
+         entry beg end)
+      (gnus-narrow-to-headers)
+      (while alist
+       ;; Each alist entry.
+       (setq entry (car alist)
+             alist (cdr alist))
+       (goto-char (point-min))
+       (while (re-search-forward (car entry) nil t)
+         ;; Each header matching the entry.
+         (setq beg (match-beginning 0))
+         (setq end (or (and (re-search-forward "^[^ \t]" nil t)
+                            (match-beginning 0))
+                       (point-max)))
+         (goto-char beg)
+         (while (re-search-forward (nth 1 entry) end t)
+           ;; Each match within a header.
+           (let* ((from (match-beginning 0))
+                  (entry (cdr entry))
+                  (start (match-beginning (nth 1 entry)))
+                  (end (match-end (nth 1 entry)))
+                  (form (nth 2 entry)))
+             (goto-char (match-end 0))
+             (and (eval form)
+                  (gnus-article-add-button 
+                   start end (nth 3 entry)
+                   (buffer-substring (match-beginning (nth 4 entry))
+                                     (match-end (nth 4 entry)))))))
+         (goto-char end))))
+    (widen)))
+
+
 
 ;;; External functions:
 
@@ -1340,11 +1400,12 @@ External references are things like message-ids and URLs, as specified by
   (and gnus-article-button-face
        (gnus-overlay-put (gnus-make-overlay from to)
                         'face gnus-article-button-face))
-  (add-text-properties from to
-                      (append (and gnus-article-mouse-face
-                                   (list 'mouse-face gnus-article-mouse-face))
-                              (list 'gnus-callback fun)
-                              (and data (list 'gnus-data data)))))
+  (add-text-properties 
+   from to
+   (nconc (and gnus-article-mouse-face
+              (list gnus-mouse-face-prop gnus-article-mouse-face))
+         (list 'gnus-callback fun)
+         (and data (list 'gnus-data data)))))
 
 ;;; Internal functions:
 
@@ -1400,11 +1461,51 @@ External references are things like message-ids and URLs, as specified by
                      (cons fun args)))))))
 
 (defun gnus-button-message-id (message-id)
-  ;; Push on MESSAGE-ID.
+  "Fetch MESSAGE-ID."
   (save-excursion
     (set-buffer gnus-summary-buffer)
     (gnus-summary-refer-article message-id)))
 
+(defun gnus-button-mailto (address)
+  ;; Mail to ADDRESS.
+  (gnus-new-mail address))
+
+(defun gnus-button-reply (address)
+  ;; Reply to ADDRESS.
+  (gnus-mail-reply t address))
+
+(defun gnus-button-url (address)
+  "Browse ADDRESS."
+  (funcall browse-url-browser-function address))
+
+;;; Next/prev buttons in the article buffer.
+
+(defvar gnus-next-page-line-format "%{%(Next page...%)%}\n")
+(defvar gnus-prev-page-line-format "%{%(Previous page...%)%}\n")
+
+(defvar gnus-prev-page-map nil)
+(unless gnus-prev-page-map
+  (setq gnus-prev-page-map (make-sparse-keymap))
+  (define-key gnus-prev-page-map gnus-mouse-2 'gnus-article-prev-page)
+  (define-key gnus-prev-page-map "\r" 'gnus-article-prev-page))
+
+(defun gnus-insert-prev-page-button ()
+  (let ((buffer-read-only nil))
+    (gnus-eval-format gnus-prev-page-line-format nil
+                     `(gnus-prev t local-map ,gnus-prev-page-map))))
+
+(defvar gnus-next-page-map nil)
+(unless gnus-next-page-map
+  (setq gnus-next-page-map (make-keymap))
+  (suppress-keymap gnus-prev-page-map)
+  (define-key gnus-next-page-map gnus-mouse-2 'gnus-article-next-page)
+  (define-key gnus-next-page-map "\r" 'gnus-article-next-page))
+
+(defun gnus-insert-next-page-button ()
+  (let ((buffer-read-only nil))
+    (gnus-eval-format gnus-next-page-line-format nil
+                     `(gnus-next t local-map ,gnus-next-page-map))))
+
 ;;; Compatibility Functions:
 
 (or (fboundp 'rassoc)