(spam-stat-store-gnus-article-buffer): Use
authorJesper Harder <harder@ifa.au.dk>
Fri, 23 Jan 2004 02:04:44 +0000 (02:04 +0000)
committerJesper Harder <harder@ifa.au.dk>
Fri, 23 Jan 2004 02:04:44 +0000 (02:04 +0000)
with-current-buffer.
(spam-stat-store-current-buffer): Use insert-buffer-substring to
avoid consing a string.

lisp/ChangeLog
lisp/spam-stat.el

index 73fbacf..e9255e7 100644 (file)
@@ -1,5 +1,10 @@
 2004-01-23  Jesper Harder  <harder@ifa.au.dk>
 
+       * spam-stat.el (spam-stat-store-gnus-article-buffer): Use
+       with-current-buffer.
+       (spam-stat-store-current-buffer): Use insert-buffer-substring to
+       avoid consing a string.
+
        * mm-util.el (mm-charset-synonym-alist): Add ks_c_5601-1987.
        Remove obsolete entries for big5 and gb2312.
 
index b7b7cd2..9d43ef8 100644 (file)
@@ -198,18 +198,16 @@ This is set by hooking into Gnus.")
 
 (defun spam-stat-store-current-buffer ()
   "Store a copy of the current buffer in `spam-stat-buffer'."
-  (save-excursion
-    (let ((str (buffer-string)))
-      (set-buffer (get-buffer-create spam-stat-buffer-name))
+  (let ((buf (current-buffer)))
+    (with-current-buffer (get-buffer-create spam-stat-buffer-name)
       (erase-buffer)
-      (insert str)
+      (insert-buffer-substring buf)
       (setq spam-stat-buffer (current-buffer)))))
 
 (defun spam-stat-store-gnus-article-buffer ()
   "Store a copy of the current article in `spam-stat-buffer'.
 This uses `gnus-article-buffer'."
-  (save-excursion
-    (set-buffer gnus-original-article-buffer)
+  (with-current-buffer gnus-original-article-buffer
     (spam-stat-store-current-buffer)))
 
 ;; Data -- not using defstruct in order to save space and time