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

Re: pp costs time



>>>>> In <78k84cgx3g.fsf@karin.namazu.org> 
>>>>>	Katsumi Yamaoka <yamaoka@namazu.org> wrote:

山岡> ううむ pp って重いのですねえ。

[...]

山岡> pp の全機能は要らない簡単な処理だと思うので、そういうプログラム
山岡> を書いてしまうのではいかがでしょうか?

言い出しっぺから案を一つ。:-)
--- w3m.el~	Mon Apr 23 12:20:42 2001
+++ w3m.el	Mon Apr 23 22:59:53 2001
@@ -819,10 +819,28 @@
     (with-temp-buffer
       (let ((file-coding-system coding)
 	    (coding-system-for-write coding)
-	    print-length print-level)
-	(w3m-static-if (fboundp 'pp)
-	    (pp list (current-buffer))
-	  (print list (current-buffer)))
+	    (standard-output (current-buffer))
+	    element print-length print-level)
+	(insert "(")
+	(while list
+	  (setq element (car list)
+		list (cdr list))
+	  (if (consp element)
+	      (progn
+		(insert "(")
+		(prin1 (car element))
+		(insert "\n")
+		(while (setq element (cdr element))
+		  (insert "  ")
+		  (prin1 (car element))
+		  (insert "\n"))
+		(backward-delete-char 1)
+		(insert ")\n "))
+	    (prin1 element)
+	    (insert "\n")))
+	(skip-chars-backward "\n ")
+	(delete-region (point) (point-max))
+	(insert ")\n")
 	(let ((mode (and (file-exists-p file)
 			 (file-modes file))))
 	  (write-region (point-min) (point-max) file nil 'nomsg)
@@ -2355,7 +2373,9 @@
   "Quit browsing WWW after updating arrived URLs list."
   (interactive "P")
   (when (or force
-	    (y-or-n-p "Do you want to exit w3m? "))
+	    (prog1
+		(y-or-n-p "Do you want to exit w3m? ")
+	      (message "")))
     (kill-buffer (current-buffer))
     (unless (w3m-alive-p)
       ;; If no w3m is running, then destruct all data.