*** empty log message ***
[gnus] / lisp / gnus-vis.el
index e23c2bb..d96abf6 100644 (file)
 (defvar gnus-button-alist 
   `(("\\bin\\( +article\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2 
      t gnus-button-message-id 3)
+    ("\\(<?\\(url: ?\\)?news:\\([^>\n\t ]*\\)>?\\)" 1 t
+     gnus-button-message-id 3)
+    ("\\(<URL: *\\)?mailto: *\\([^> \n\t]+\\)>?" 0 t gnus-button-reply 2)
     ;; 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.
-    (,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))
+    (,gnus-button-url-regexp 0 t gnus-button-url 0))
   "Alist of regexps matching buttons in article bodies.
 
 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
@@ -238,10 +238,13 @@ 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)
+    ("^\\(From\\|Reply-To\\):" ": *\\(.+\\)$" 1 t gnus-button-reply 1)
     ("^\\(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))
+    ("^X-[Uu][Rr][Ll]:" ,gnus-button-url-regexp 0 t gnus-button-url 0)
+    ("^[^:]+:" ,gnus-button-url-regexp 0 t gnus-button-url 0)
+    ("^[^:]+:" "\\(<\\(url: \\)?news:\\([^>\n ]*\\)>\\)" 1 t
+     gnus-button-message-id 3))
   "Alist of headers and regexps to match buttons in article heads.
 
 This alist is very similar to `gnus-button-alist', except that each
@@ -258,38 +261,22 @@ HEADER is a regexp to match a header.  For a fuller explanation, see
 
 ;;; Group mode highlighting.
 
-(defvar gnus-group-highlight
-  (cond 
-   ((not (eq gnus-display-type 'color))
-    '((mailp . bold)
-      ((= unread 0) . italic)))
-   ((eq gnus-background-mode 'dark)
-    `(((> unread 200) . ,(custom-face-lookup "Red" nil nil t nil nil))
-      ((and (< level 3) (zerop unread)) . 
-       ,(custom-face-lookup "SeaGreen" nil nil t nil nil))
-      ((< level 3) . ,(custom-face-lookup "SpringGreen" nil nil t nil nil))
-      ((zerop unread) . ,(custom-face-lookup "SteelBlue" nil nil t nil nil))
-      (t . ,(custom-face-lookup "SkyBlue" nil nil t nil nil))
-      ))
-   (t
-    `(((not mailp) .
-       ,(custom-face-lookup "ForestGreen" nil nil t nil nil))
-      ((zerop unread) .
-       ,(custom-face-lookup "Blue" nil nil t nil nil)))))
-  "Group lines are highlighted with the FACE for the first FORM which
-evaluate to a non-nil value.  
-
-Point will be at the beginning of the line when FORM is evaluated.
-Variables bound when these forms are evaluated include:
-
-group: The group name.
-unread: The number of unread articles.
-method: The select method.
-mailp: Whether the select method is a mail method.
-level: The level of the group.
-score: The score of the group.
-ticked: The number of ticked articles in the group.
-")
+;see gnus-cus.el
+;(defvar gnus-group-highlight nil
+;  "Group lines are highlighted with the FACE for the first FORM which
+;evaluate to a non-nil value.  
+;
+;Point will be at the beginning of the line when FORM is evaluated.
+;Variables bound when these forms are evaluated include:
+;
+;group: The group name.
+;unread: The number of unread articles.
+;method: The select method.
+;mailp: Whether the select method is a mail method.
+;level: The level of the group.
+;score: The score of the group.
+;ticked: The number of ticked articles in the group.
+;")
 
 
 ;;; Internal variables.
@@ -353,8 +340,8 @@ ticked: The number of ticked articles in the group.
       gnus-group-group-menu gnus-group-mode-map ""
       '("Groups"
        ("Listing"
-        ["List subscribed groups" gnus-group-list-groups t]
-        ["List all groups" gnus-group-list-all-groups t]
+        ["List unread subscribed groups" gnus-group-list-groups t]
+        ["List (un)subscribed groups" gnus-group-list-all-groups t]
         ["List killed groups" gnus-group-list-killed gnus-killed-list]
         ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
         ["List level..." gnus-group-list-level t]
@@ -366,19 +353,19 @@ ticked: The number of ticked articles in the group.
         ["List active file" gnus-group-list-active t])
        ("Sort"
         ["Default sort" gnus-group-sort-groups
-         (not gnus-topic-mode)]
+         (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
         ["Sort by method" gnus-group-sort-groups-by-method
-         (not gnus-topic-mode)]
+         (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
         ["Sort by rank" gnus-group-sort-groups-by-rank
-         (not gnus-topic-mode)]
+         (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
         ["Sort by score" gnus-group-sort-groups-by-score
-         (not gnus-topic-mode)]
+         (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
         ["Sort by level" gnus-group-sort-groups-by-level
-         (not gnus-topic-mode)]
+         (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
         ["Sort by unread" gnus-group-sort-groups-by-unread
-         (not gnus-topic-mode)]
+         (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
         ["Sort by name" gnus-group-sort-groups-by-alphabet
-         (not gnus-topic-mode)])
+         (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))])
        ("Mark"
         ["Mark group" gnus-group-mark-group
          (and (gnus-group-group-name)
@@ -388,14 +375,13 @@ ticked: The number of ticked articles in the group.
               (memq (gnus-group-group-name) gnus-group-marked))]
         ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
         ["Mark regexp..." gnus-group-mark-regexp t]
-        ["Mark region" gnus-group-mark-region (region-exists-p)]
+        ["Mark region" gnus-group-mark-region t]
         ["Mark buffer" gnus-group-mark-buffer t]
         ["Execute command" gnus-group-universal-argument
          (or gnus-group-marked (gnus-group-group-name))])
        ("Subscribe"
-        ["Subscribe to random group" gnus-group-unsubscribe-group t]
-        ["Kill all newsgroups in region" gnus-group-kill-region
-         (region-exists-p)]
+        ["Subscribe to a group" gnus-group-unsubscribe-group t]
+        ["Kill all newsgroups in region" gnus-group-kill-region t]
         ["Kill all zombie groups" gnus-group-kill-all-zombies
          gnus-zombie-list]
         ["Kill all groups on level..." gnus-group-kill-level t])
@@ -445,8 +431,7 @@ ticked: The number of ticked articles in the group.
        ["Send a bug report" gnus-bug t]
        ["Send a mail" gnus-group-mail t]
        ["Post an article..." gnus-group-post-news t]
-       ["Customize score file" gnus-score-customize 
-        (not (string-match "XEmacs" emacs-version))]
+       ["Customize score file" gnus-score-customize t]
        ["Check for new news" gnus-group-get-new-news t]     
        ["Activate all groups" gnus-activate-all-groups t]
        ["Delete bogus groups" gnus-group-check-bogus-groups t]
@@ -495,8 +480,7 @@ ticked: The number of ticked articles in the group.
         ["Catchup" gnus-summary-catchup t]
         ["Catchup all" gnus-summary-catchup-all t]
         ["Catchup to here" gnus-summary-catchup-to-here t]
-        ["Catchup region" gnus-summary-mark-region-as-read
-         (region-exists-p)]
+        ["Catchup region" gnus-summary-mark-region-as-read t]
         ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
        ("Various"
         ["Tick" gnus-summary-tick-article-forward t]
@@ -525,7 +509,7 @@ ticked: The number of ticked articles in the group.
         ["Remove all marks" gnus-summary-unmark-all-processable t]
         ["Mark above" gnus-uu-mark-over t]
         ["Mark series" gnus-uu-mark-series t]
-        ["Mark region" gnus-uu-mark-region (region-exists-p)]
+        ["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]
@@ -805,8 +789,6 @@ ticked: The number of ticked articles in the group.
        ["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 ""
      '("Threads"
@@ -1007,16 +989,16 @@ ticked: The number of ticked articles in the group.
         (score (or (cdr (assq (or article gnus-current-article)
                               gnus-newsgroup-scored))
                    gnus-summary-default-score 0))
-        (default gnus-summary-default-score)
         (mark (or (gnus-summary-article-mark) gnus-unread-mark))
         (inhibit-read-only t))
     ;; Eval the cars of the lists until we find a match.
-    (while (and list
-               (not (eval (caar list))))
-      (setq list (cdr list)))
+    (let ((default gnus-summary-default-score))
+      (while (and list
+                 (not (eval (caar list))))
+       (setq list (cdr list))))
     (let ((face (cdar list)))
       (unless (eq face (get-text-property beg 'face))
-       (put-text-property 
+       (gnus-put-text-property 
         beg end 'face 
         (setq face (if (boundp face) (symbol-value face) face)))
        (when gnus-summary-highlight-line-function
@@ -1049,7 +1031,7 @@ ticked: The number of ticked articles in the group.
       (setq list (cdr list)))
     (let ((face (cdar list)))
       (unless (eq face (get-text-property beg 'face))
-       (put-text-property 
+       (gnus-put-text-property 
         beg end 'face 
         (setq face (if (boundp face) (symbol-value face) face)))
        (gnus-extent-start-open beg)))
@@ -1351,14 +1333,14 @@ do the highlighting.  See the documentation for those functions."
              (when (and header-face
                         (not (memq (point) hpoints)))
                (push (point) hpoints)
-               (put-text-property from (point) 'face header-face))
+               (gnus-put-text-property from (point) 'face header-face))
              (when (and field-face
                         (not (memq (setq from (point)) fpoints)))
                (push from fpoints)
                (if (re-search-forward "^[^ \t]" nil t)
                    (forward-char -2)
                  (goto-char (point-max)))
-               (put-text-property from (point) 'face field-face)))))))))
+               (gnus-put-text-property from (point) 'face field-face)))))))))
 
 (defun gnus-article-highlight-signature ()
   "Highlight the signature in an article.
@@ -1464,7 +1446,7 @@ specified by `gnus-button-alist'."
   (and gnus-article-button-face
        (gnus-overlay-put (gnus-make-overlay from to)
                         'face gnus-article-button-face))
-  (add-text-properties 
+  (gnus-add-text-properties 
    from to
    (nconc (and gnus-article-mouse-face
               (list gnus-mouse-face-prop gnus-article-mouse-face))
@@ -1509,14 +1491,15 @@ specified by `gnus-button-alist'."
                              0 (length string) nil string)
                             string))
                         (nthcdr 4 entry))))
-      (cond ((fboundp fun)
-            (apply fun args))
-           ((and (boundp fun)
-                 (fboundp (symbol-value fun)))
-            (apply (symbol-value fun) args))
-           (t
-            (gnus-message 1 "You must define `%S' to use this button"
-                          (cons fun args)))))))
+      (cond
+       ((fboundp fun)
+       (apply fun args))
+       ((and (boundp fun)
+            (fboundp (symbol-value fun)))
+       (apply (symbol-value fun) args))
+       (t
+       (gnus-message 1 "You must define `%S' to use this button"
+                     (cons fun args)))))))
 
 (defun gnus-button-message-id (message-id)
   "Fetch MESSAGE-ID."
@@ -1526,11 +1509,12 @@ specified by `gnus-button-alist'."
 
 (defun gnus-button-mailto (address)
   ;; Mail to ADDRESS.
-  (gnus-new-mail address))
+  (set-buffer (gnus-copy-article-buffer))
+  (message-reply address))
 
 (defun gnus-button-reply (address)
   ;; Reply to ADDRESS.
-  (message-reply address))
+  (message-reply address))
 
 (defun gnus-button-url (address)
   "Browse ADDRESS."
@@ -1544,8 +1528,8 @@ specified by `gnus-button-alist'."
 (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))
+  (define-key gnus-prev-page-map gnus-mouse-2 'gnus-button-prev-page)
+  (define-key gnus-prev-page-map "\r" 'gnus-button-prev-page))
 
 (defun gnus-insert-prev-page-button ()
   (let ((buffer-read-only nil))
@@ -1558,8 +1542,24 @@ specified by `gnus-button-alist'."
 (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))
+  (define-key gnus-next-page-map gnus-mouse-2 'gnus-button-next-page)
+  (define-key gnus-next-page-map "\r" 'gnus-button-next-page))
+
+(defun gnus-button-next-page ()
+  "Go to the next page."
+  (interactive)
+  (let ((win (selected-window)))
+    (select-window (get-buffer-window gnus-article-buffer t))
+    (gnus-article-next-page)
+    (select-window win)))
+
+(defun gnus-button-prev-page ()
+  "Go to the prev page."
+  (interactive)
+  (let ((win (selected-window)))
+    (select-window (get-buffer-window gnus-article-buffer t))
+    (gnus-article-prev-page)
+    (select-window win)))
 
 (defun gnus-insert-next-page-button ()
   (let ((buffer-read-only nil))