;;; Code:
+(eval-when-compile (require 'cl))
+
(require 'gnus)
(require 'gnus-art)
(require 'gnus-range)
:type 'regexp)
(defcustom gnus-cite-attribution-suffix
- "\\(\\(wrote\\|writes\\|said\\|says\\|>\\)\\(:\\|\\.\\.\\.\\)\\)[ ]*$"
+ "\\(\\(wrote\\|writes\\|said\\|says\\|>\\)\\(:\\|\\.\\.\\.\\)\\)[ \t]*$"
"Regexp matching the end of an attribution line.
The text matching the first grouping will be used as a button."
:group 'gnus-cite
;;; Internal Variables:
(defvar gnus-cite-article nil)
+(defvar gnus-cite-overlay-list nil)
(defvar gnus-cite-prefix-alist nil)
;; Alist of citation prefixes.
(gnus-article-search-signature)
(push (cons (point-marker) "") marks)
;; Sort the marks.
- (setq marks (sort marks (lambda (m1 m2) (< (car m1) (car m2)))))
+ (setq marks (sort marks 'car-less-than-car))
(let ((omarks marks))
(setq marks nil)
(while (cdr omarks)
If given a negative prefix, always show; if given a positive prefix,
always hide."
(interactive (append (gnus-article-hidden-arg) (list 'force)))
- (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))
+ (gnus-set-format 'cited-text-button t)
(save-excursion
(set-buffer gnus-article-buffer)
(cond
(defun gnus-cite-parse-maybe (&optional force)
;; Parse if the buffer has changes since last time.
- (if (equal gnus-cite-article gnus-article-current)
+ (if (and (not force) (equal gnus-cite-article gnus-article-current))
()
;;Reset parser information.
(setq gnus-cite-prefix-alist nil
gnus-cite-attribution-alist nil
gnus-cite-loose-prefix-alist nil
gnus-cite-loose-attribution-alist nil)
+ (while gnus-cite-overlay-list
+ (gnus-delete-overlay (pop gnus-cite-overlay-list)))
;; Parse if not too large.
(if (and (not force)
gnus-cite-parse-max-size
;; At line NUMBER, ignore PREFIX and add FACE to the rest of the line.
(when face
(let ((inhibit-point-motion-hooks t)
- from to)
+ from to overlay)
(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))
(skip-chars-backward " \t")
(setq to (point))
(when (< from to)
- (gnus-overlay-put (gnus-make-overlay from to) 'face face))))))
+ (push (setq overlay (gnus-make-overlay from to))
+ gnus-cite-overlay-list)
+ (gnus-overlay-put overlay 'face face))))))
(defun gnus-cite-toggle (prefix)
(save-excursion