New function to guess whether a long line is natural text or not.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 31 Aug 2010 13:49:31 +0000 (15:49 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 31 Aug 2010 13:49:31 +0000 (15:49 +0200)
lisp/ChangeLog
lisp/gnus-cite.el

index 27b44f6..4e2da57 100644 (file)
@@ -1,5 +1,8 @@
 2010-08-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-cite.el (gnus-article-natural-long-line-p): New function to
+       guess whether a long line is natural text or not.
+
        * gnus-html.el (gnus-html-schedule-image-fetching): Use
        gnus-process-plist and friends for compatibility.
 
index adec9cf..9502bd8 100644 (file)
@@ -552,6 +552,24 @@ If WIDTH (the numerical prefix), use that text width when filling."
              gnus-cite-loose-attribution-alist nil
              gnus-cite-article nil)))))
 
+(defun gnus-article-natural-long-line-p ()
+  "Return true if the current line is long, and it's natural text."
+  (save-excursion
+    (beginning-of-line)
+    (and
+     ;; The line is long.
+     (> (- (line-end-position) (line-beginning-position))
+       (frame-width))
+     ;; It doesn't start with spaces.
+     (not (looking-at "    "))
+     ;; Not cited text.
+     (let ((line-number (1+ (count-lines (point-min) (point))))
+          citep)
+       (dolist (elem gnus-cite-prefix-alist)
+        (when (member line-number (cdr elem))
+          (setq citep t)))
+       (not citep)))))
+
 (defun gnus-article-hide-citation (&optional arg force)
   "Toggle hiding of all cited text except attribution lines.
 See the documentation for `gnus-article-highlight-citation'.