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

Re: [emacs-w3m:00048] Re: Google search



At Sun, 04 Mar 2001 16:27:15 +0900 (JST),
Shun-ichi GOTO wrote:
> 
> 西田> ちょこちょこっと手を入れてみました。
> 
> 代理で適用しました。(rev. 1.50)

ありがとうございます。で、次のパッチです :)

* コマンド引数に -S を追加。これで空行が取り除かれるはず。
* make-local-variable はトップレベルで呼ぶようにした。
* w3m-goto-next/previous-anchor のバグを修正。

> w3m-command-argumentに関しては、元からその形になっていますので適用はしま
> せんでした。lambdaを指定するのでも良いのですが、customizeでlambdaを指定
> させるのも酷だし。

うーん、最近 Scheme ばかり使ってるもので、lambda が自然と馴染んでるので
した・・。ダイナミックに S 式を eval するなんて気持ち悪くて ;)

-- Kei

Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.50
diff -u -r1.50 w3m.el
--- w3m.el	2001/03/04 07:18:40	1.50
+++ w3m.el	2001/03/04 07:58:17
@@ -85,7 +85,7 @@
   :type 'string)
 
 (defcustom w3m-command-arguments
-  '("-T" "text/html" "-t" tab-width "-halfdump"
+  '("-T" "text/html" "-t" tab-width "-halfdump" "-S"
     "-cols" (1- (frame-width)))
   "*Arguments of w3m."
   :group 'w3m
@@ -360,6 +360,10 @@
 (defvar w3m-current-title nil "Title of this buffer.")
 (defvar w3m-url-history nil "History of URL.")
 
+(make-local-variable 'w3m-current-url)
+(make-local-variable 'w3m-current-title)
+(make-local-variable 'w3m-url-history)
+
 (defvar w3m-verbose t "Flag variable to control messages.")
 
 (defvar w3m-backlog-buffer nil)
@@ -376,7 +380,9 @@
 (defvar w3m-process-user-counter 0)
 (defvar w3m-process-temp-file nil)
 
+(make-local-variable 'w3m-process-temp-file)
+
 (defvar w3m-bookmark-data nil)
 (defvar w3m-bookmark-file-time-stamp nil)
 (defvar w3m-bookmark-section-history nil)
@@ -577,10 +582,7 @@
 	  (insert (cdr elem))))
       (set-buffer-multibyte x))
     (goto-char (point-min))
-    (if w3m-delete-duplicated-empty-lines
-	(while (re-search-forward "^[ \t]*\n\\([ \t]*\n\\)+" nil t)
-	  (replace-match "\n" nil t)))
     (run-hooks 'w3m-fontify-after-hook)))
 
 ;;
@@ -1140,7 +1138,7 @@
 	       (stringp w3m-current-url)
 	       (< 0 (length (file-name-nondirectory w3m-current-url))))
 	  (setq title (file-name-nondirectory w3m-current-url)))
-      (set (make-local-variable 'w3m-current-title) (or title "<no-title>")))))
+      (setq w3m-current-title (or title "<no-title>")))))
 
 (defun w3m-exec (url &optional buffer no-cache)
   "Download URL with w3m to the BUFFER.
@@ -1155,17 +1153,15 @@
       (let ((type (w3m-retrieve url nil "^text/" no-cache)))
 	(if (string-match "^text/" type)
 	    (let (buffer-read-only)
-	      (set (make-local-variable 'w3m-current-url) url)
-	      (set (make-local-variable 'w3m-url-history)
-		   (cons url w3m-url-history))
+	      (setq w3m-current-url url)
+	      (setq w3m-url-history (cons url w3m-url-history))
 	      (setq-default w3m-url-history
 			    (cons url (default-value 'w3m-url-history)))
 	      (delete-region (point-min) (point-max))
 	      (insert-buffer w3m-work-buffer-name)
 	      (if (string= "text/html" type)
 		  (progn (w3m-rendering-region (point-min) (point-max)) t)
-		(set (make-local-variable 'w3m-current-title)
-		     (file-name-nondirectory url))
+		(setq w3m-current-title (file-name-nondirectory url))
 		nil))
 	  (w3m-message "Requested URL has an unsuitable content type: %s" type)
 	  nil)))))
@@ -1281,7 +1277,7 @@
 			       (current-buffer)
 			       command
 			       (mapcar (function eval) arguments)))
-		  (set (make-local-variable 'w3m-process-temp-file) file)
+		  (setq w3m-process-temp-file file)
 		  (set-process-sentinel
 		   proc
 		   (lambda (proc event)
@@ -1362,8 +1358,9 @@
   (when (get-text-property (point) 'w3m-href-anchor)
     (goto-char (next-single-property-change (point) 'w3m-href-anchor)))
   ;; find the next anchor
-  (let ((pos (next-single-property-change (point) 'w3m-href-anchor)))
-    (if pos (progn (goto-char pos) t) nil)))
+  (if (get-text-property (point) 'w3m-href-anchor) t
+    (let ((pos (next-single-property-change (point) 'w3m-href-anchor)))
+      (if pos (progn (goto-char pos) t) nil))))
 
 (defun w3m-next-anchor (&optional arg)
   "*Move cursor to the next anchor."
@@ -1381,13 +1378,15 @@
 
 (defun w3m-goto-previous-anchor ()
   ;; move to the beginning of the current anchor
-  (when (and (not (bobp)) (get-text-property (1- (point)) 'w3m-href-anchor))
-    (goto-char (previous-single-property-change (point) 'w3m-href-anchor)))
+  (when (get-text-property (point) 'w3m-href-anchor)
+    (goto-char (previous-single-property-change (1+ (point))
+						'w3m-href-anchor)))
   ;; find the previous anchor
   (let ((pos (previous-single-property-change (point) 'w3m-href-anchor)))
-    (if pos (progn (goto-char (previous-single-property-change
-			       pos 'w3m-href-anchor)) t) nil)))
+    (if pos (goto-char
+	     (if (get-text-property pos 'w3m-href-anchor) pos
+	       (previous-single-property-change pos 'w3m-href-anchor))))))
 
 (defun w3m-previous-anchor (&optional arg)
   "Move cursor to the previous anchor."