;; 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.
+ "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,
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-ID\\):" "<[^>]+>" 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))
+ "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))
["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
["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]
["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]
["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]
["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]
["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]
("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]
["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])
["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]
["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]))
["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)
)))
(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)
+ (score (or (cdr (assq (or (gnus-summary-article-number)
gnus-current-article)
gnus-newsgroup-scored))
gnus-summary-default-score 0))
(default gnus-summary-default-score)
- (mark (get-text-property beg 'gnus-mark))
+ (mark (gnus-summary-article-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))))
(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.
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)
()
()
(goto-char (match-end 0))
(if (eval form)
- (gnus-article-add-button start end 'gnus-button-push
- (set-marker (make-marker)
- from)))))))))
+ (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)))
+
(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 ")'"))))
+ (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)
(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 'mouse-face gnus-article-mouse-face))
+ (list 'gnus-callback fun)
+ (and data (list 'gnus-data data)))))
;;; Internal functions:
(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))
+
;;; Compatibility Functions:
(or (fboundp 'rassoc)