Changes committed gnus/lisp (mm-util.el spam-report.el)

"Katsumi Yamaoka" <[email protected]> Wed, 24 Dec 2008 03:30:41 +0100
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: mm-util.el spam-report.el

* mm-util.el (mm-line-number-at-pos): New function.
* spam-report.el (spam-report-process-queue): Use it.


Index: mm-util.el
diff -u gnus/lisp/mm-util.el:7.87 gnus/lisp/mm-util.el:7.88
--- mm-util.el:7.87	Mon Dec 22 00:45:14 2008
+++ mm-util.el	Wed Dec 24 03:30:41 2008
@@ -154,7 +154,22 @@
 With one argument, just copy STRING without its properties."
 	   (setq string (substring string (or from 0) to))
 	   (set-text-properties 0 (length string) nil string)
-	   string)))))
+	   string))
+     ;; `line-number-at-pos' is available only in Emacs 22.1 or greater
+     ;; and XEmacs 21.5.
+     (line-number-at-pos
+      . ,(lambda (&optional pos)
+	   "Return (narrowed) buffer line number at position POS.
+If POS is nil, use current buffer location.
+Counting starts at (point-min), so the value refers
+to the contents of the accessible portion of the buffer."
+	   (let ((opoint (or pos (point))) start)
+	     (save-excursion
+	       (goto-char (point-min))
+	       (setq start (point))
+	       (goto-char opoint)
+	       (forward-line 0)
+	       (1+ (count-lines start (point))))))))))
 
 ;; `decode-coding-string', `encode-coding-string', `decode-coding-region'
 ;; and `encode-coding-region' are available in Emacs and XEmacs built with
Index: spam-report.el
diff -u gnus/lisp/spam-report.el:7.40 gnus/lisp/spam-report.el:7.41
--- spam-report.el:7.40	Mon Dec 22 23:06:59 2008
+++ spam-report.el	Wed Dec 24 03:30:41 2008
@@ -299,7 +299,8 @@
 		(re-search-forward
 		 "http://\\([^/]+\\)\\(/.*\\) *$" (point-at-eol) t))
       (let ((spam-report-gmane-wait
-	     (zerop (% (line-number-at-pos) spam-report-gmane-max-requests))))
+	     (zerop (% (mm-line-number-at-pos)
+		       spam-report-gmane-max-requests))))
 	(gnus-message 6 "Reporting %s%s..."
 		      (match-string 1) (match-string 2))
 	(funcall spam-report-url-ping-function