erbot-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erbot-cvs] Changes to erbot/erbc.el


From: Pete Kazmier
Subject: [Erbot-cvs] Changes to erbot/erbc.el
Date: Sat, 08 Jan 2005 10:50:23 -0500

Index: erbot/erbc.el
diff -u erbot/erbc.el:1.77 erbot/erbc.el:1.78
--- erbot/erbc.el:1.77  Sat Jan  8 05:17:47 2005
+++ erbot/erbc.el       Sat Jan  8 15:14:24 2005
@@ -4140,35 +4140,37 @@
 
 (defalias 'fsi-shell-test 'erbnoc-shell-test)
 
+(defmacro erbnoc-with-web-page-buffer (site &rest body)
+  (let ((buffer (make-symbol "web-buffer")))
+    `(let ((,buffer (url-retrieve-synchronously ,site)))
+       (save-excursion
+         (set-buffer ,buffer)
+         (goto-char (point-min))
+         (prog1
+             (progn
+               ,@body)
+           (kill-buffer ,buffer))))))
+
 (defun fsi-wserver (&optional site &rest args)
   (unless site (error (format "Syntax: %s wserver SITE" erbnoc-char)))
   (setq site (format "%s" site))
-  (let ((buffer (url-retrieve-synchronously site)))
-    (save-excursion
-      (set-buffer buffer)
-      (goto-char (point-min))
-      (prog1
-          (buffer-substring (point-min) 
-                            (or (search-forward "\n\n" nil t)
-                                (point-max)))
-        (kill-buffer buffer)))))
+  (erbnoc-with-web-page-buffer site
+    (buffer-substring (point-min) 
+                      (or (search-forward "\n\n" nil t)
+                          (point-max)))))
 
 (defalias 'fs-webserver 'fs-wserver)
 
 (defun fsi-web (&optional site &rest args)
   (unless site (error (format "Syntax: %s web SITE" erbnoc-char)))
   (setq site (format "%s" site))
-  (let ((buffer (url-retrieve-synchronously site)))
-    (save-excursion
-      (set-buffer buffer)
-      (goto-char (point-min))
-      (shell-command-on-region (or (search-forward "\n\n" nil t)
-                                   (point-min))
-                               (point-max)
-                               "w3m -dump -T text/html" t t)
-      (prog1
-          (buffer-substring (point) (mark))
-        (kill-buffer buffer)))))
+  (erbnoc-with-web-page-buffer site
+    (shell-command-on-region (or (search-forward "\n\n" nil t)
+                                 (point-min))
+                             (point-max)
+                             "w3m -dump -T text/html" t t)
+    (buffer-substring (point) (mark))))
+
 
 ;;;###autoload
 (defun fsi-length-load-history ()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]