(require 'gnus-art)
(require 'gnus-range)
-(eval-and-compile
- (autoload 'gnus-article-add-button "gnus-vis"))
-
;;; Customization:
(defvar gnus-cited-text-button-line-format "%(%{[...]%}%)\n"
(defvar gnus-cite-minimum-match-count 2
"Minimum number of identical prefixes before we believe it's a citation.")
-;see gnus-cus.el
-;(defvar gnus-cite-face-list
-; (if (eq gnus-display-type 'color)
-; (if (eq gnus-background-mode 'dark) 'light 'dark)
-; '(italic))
-; "Faces used for displaying different citations.
-;It is either a list of face names, or one of the following special
-;values:
-
-;dark: Create faces from `gnus-face-dark-name-list'.
-;light: Create faces from `gnus-face-light-name-list'.
-
-;The variable `gnus-make-foreground' determines whether the created
-;faces change the foreground or the background colors.")
-
(defvar gnus-cite-attribution-prefix "in article\\|in <"
"Regexp matching the beginning of an attribution line.")
"Regexp matching the end of an attribution line.
The text matching the first grouping will be used as a button.")
-;see gnus-cus.el
-;(defvar gnus-cite-attribution-face 'underline
-; "Face used for attribution lines.
-;It is merged with the face for the cited text belonging to the attribution.")
-
-;see gnus-cus.el
-;(defvar gnus-cite-hide-percentage 50
-; "Only hide cited text if it is larger than this percent of the body.")
-
-;see gnus-cus.el
-;(defvar gnus-cite-hide-absolute 10
-; "Only hide cited text if there is at least this number of cited lines.")
-
-;see gnus-cus.el
-;(defvar gnus-face-light-name-list
-; '("light blue" "light cyan" "light yellow" "light pink"
-; "pale green" "beige" "orange" "magenta" "violet" "medium purple"
-; "turquoise")
-; "Names of light colors.")
-
-;see gnus-cus.el
-;(defvar gnus-face-dark-name-list
-; '("dark salmon" "firebrick"
-; "dark green" "dark orange" "dark khaki" "dark violet"
-; "dark turquoise")
-; "Names of dark colors.")
+(defvar gnus-cite-attribution-face 'underline
+ "Face used for attribution lines.
+It is merged with the face for the cited text belonging to the attribution.")
+
+(defvar gnus-cite-face-list
+ (cond ((not (eq gnus-display-type 'color))
+ '(italic))
+ ((eq gnus-background-mode 'dark)
+ (mapcar 'gnus-make-face
+ gnus-face-light-name-list))
+ (t
+ (mapcar 'gnus-make-face
+ gnus-face-dark-name-list)))
+ "List of faces used for highlighting citations.
+
+When there are citations from multiple articles in the same message,
+Gnus will try to give each citation from each article its own face.
+This should make it easier to see who wrote what.")
+
+(defvar gnus-cite-hide-percentage 50
+ "Only hide excess citation if above this percentage of the body.")
+
+(defvar gnus-cite-hide-absolute 10
+ "Only hide excess citation if above this number of lines in the body.")
;;; Internal Variables:
(search-forward "\n\n" nil t)
(push (cons (point-marker) "") marks)
(goto-char (point-max))
- (re-search-backward article-signature-separator nil t)
+ (article-search-signature)
(push (cons (point-marker) "") marks)
(setq marks (sort marks (lambda (m1 m2) (< (car m1) (car m2)))))
(let* ((omarks marks))
(setq gnus-cited-text-button-line-format-spec
(gnus-parse-format gnus-cited-text-button-line-format
gnus-cited-text-button-line-format-alist t))
- (unless (article-check-hidden-text 'cite arg)
- (save-excursion
- (set-buffer gnus-article-buffer)
+ (save-excursion
+ (set-buffer gnus-article-buffer)
+ (cond
+ ((article-check-hidden-text 'cite arg)
+ t)
+ ((article-text-type-exists-p 'cite)
+ (let ((buffer-read-only nil))
+ (article-hide-text-of-type 'cite)))
+ (t
(let ((buffer-read-only nil)
(marks (gnus-dissect-cited-text))
(inhibit-point-motion-hooks t)
- (props (nconc (list 'gnus-type 'cite)
- article-hidden-properties))
+ (props (nconc (list 'article-type 'cite)
+ gnus-hidden-properties))
beg end)
(while marks
(setq beg nil
(goto-char beg)
(unless (save-excursion (search-backward "\n\n" nil t))
(insert "\n"))
- (gnus-article-add-button
+ (put-text-property
(point)
- (progn (eval gnus-cited-text-button-line-format-spec) (point))
- `gnus-article-toggle-cited-text (cons beg end))
- (set-marker beg (point))))))))
+ (progn
+ (gnus-article-add-button
+ (point)
+ (progn (eval gnus-cited-text-button-line-format-spec) (point))
+ `gnus-article-toggle-cited-text (cons beg end))
+ (point))
+ 'article-type 'annotation)
+ (set-marker beg (point)))))))))
(defun gnus-article-toggle-cited-text (region)
"Toggle hiding the text in REGION."
(funcall
(if (text-property-any
(car region) (1- (cdr region))
- (car article-hidden-properties) (cadr article-hidden-properties))
+ (car gnus-hidden-properties) (cadr gnus-hidden-properties))
'remove-text-properties 'gnus-add-text-properties)
- (car region) (cdr region) article-hidden-properties)))
+ (car region) (cdr region) gnus-hidden-properties)))
(defun gnus-article-hide-citation-maybe (&optional arg force)
"Toggle hiding of cited text that has an attribution line.
(hiden 0)
total)
(goto-char (point-max))
- (re-search-backward article-signature-separator nil t)
+ (article-search-signature)
(setq total (count-lines start (point)))
(while atts
(setq hiden (+ hiden (length (cdr (assoc (cdar atts)
(or (assq hiden gnus-cite-attribution-alist)
(gnus-add-text-properties
(point) (progn (forward-line 1) (point))
- (nconc (list 'gnus-type 'cite)
- article-hidden-properties)))))))))))
+ (nconc (list 'article-type 'cite)
+ gnus-hidden-properties)))))))))))
(defun gnus-article-hide-citation-in-followups ()
"Hide cited text in non-root articles."
(case-fold-search t)
(max (save-excursion
(goto-char (point-max))
- (re-search-backward article-signature-separator nil t)
+ (article-search-signature)
(point)))
alist entry start begin end numbers prefix)
;; Get all potential prefixes in `alist'.
;; We got all the potential prefixes. Now create
;; `gnus-cite-prefix-alist' containing the oldest prefix for each
;; line that appears at least gnus-cite-minimum-match-count
- ;; times. First sort them by length. Longer is older.
+ ;; times. First sort them by length. Longer is older.
(setq alist (sort alist (lambda (a b)
(> (length (car a)) (length (car b))))))
(while alist
(let ((inhibit-point-motion-hooks t)
from to)
(goto-line number)
- (unless (eobp) ;; Sometimes things become confused.
+ (unless (eobp);; Sometimes things become confused.
(forward-char (length prefix))
(skip-chars-forward " \t")
(setq from (point))
(goto-line number)
(cond ((get-text-property (point) 'invisible)
(remove-text-properties (point) (progn (forward-line 1) (point))
- article-hidden-properties))
+ gnus-hidden-properties))
((assq number gnus-cite-attribution-alist))
(t
(gnus-add-text-properties
(point) (progn (forward-line 1) (point))
- (nconc (list 'gnus-type 'cite)
- article-hidden-properties))))))))
+ (nconc (list 'article-type 'cite)
+ gnus-hidden-properties))))))))
(defun gnus-cite-find-prefix (line)
;; Return citation prefix for LINE.