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

Re: emacs-w3m underlines everything andmixes up URLs (new w3m-0.5?)



Sorry to be late.

As I wrote, with evaporate overlay's property, we can remove overlays when
the buffer which the overlays belong to becomes empty automatically.
I think w3m-delete-all-overlays is not needed.

I think evaporate should be t by default. I've just posted this idea
to emacs-devel. I'll continue to work on emacs to improve the
overlay's behavior. If you know other elisp project which meets the
same problem, send this mail to the developers.

Here is the patch. Yamaoka-san, could you review and install my patch?
Only 'widget-convert-button' is used as the argument for grep to find
the place where I insert '(overlay-put (widget-get w :button-overlay)
'evaporate t)'.  I'm afraid missing other places to hack.

Masatake YAMATO

Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.1012
diff -u -r1.1012 w3m.el
--- w3m.el	7 Apr 2004 03:50:07 -0000	1.1012
+++ w3m.el	7 Apr 2004 11:46:02 -0000
@@ -2889,10 +2889,13 @@
 	      (let ((widget-button-face (if (w3m-arrived-p href)
 					    'w3m-arrived-anchor-face
 					  'w3m-anchor-face))
-		    (widget-mouse-face 'highlight))
-		(widget-convert-button 'default start end
-				       :button-keymap nil
-				       :help-echo href)))
+		    (widget-mouse-face 'highlight)
+		    w)
+		(setq w (widget-convert-button 'default start end
+					       :button-keymap nil
+					       :help-echo href))
+		(overlay-put (widget-get w :button-overlay) 'evaporate t)
+		))
 	    (when name
 	      (w3m-add-text-properties start (point-max)
 				       (list 'w3m-name-anchor
@@ -4817,7 +4820,8 @@
       (let (buffer-read-only)
 	(widen)
 	(delete-region (point-min) (point-max))
-	(w3m-delete-all-overlays 'all)
+; jet
+;	(w3m-delete-all-overlays 'all)
 	(insert-buffer-substring result-buffer)
 	(w3m-copy-local-variables result-buffer)
 	(set-buffer-file-coding-system w3m-current-coding-system)
@@ -4833,7 +4837,8 @@
 	      w3m-current-title (file-name-nondirectory url))
 	(widen)
 	(delete-region (point-min) (point-max))
-	(w3m-delete-all-overlays 'all)
+; jet
+;	(w3m-delete-all-overlays 'all)
 	(insert w3m-current-title)
 	(w3m-add-text-properties (point-min) (point-max)
 				 (list 'face 'w3m-image-face
@@ -4939,7 +4944,15 @@
 	     (w3m-expand-url (or (match-string 2)
 				 (match-string 3)
 				 (match-string 1))
-			     url))))
+			     url)))
+  (and edit
+       (re-search-forward edit nil t)
+       (setq w3m-edit-url
+	     (w3m-expand-url (or (match-string 2)
+				 (match-string 3)
+				 (match-string 1))
+			     url)))
+  )
 
 (defun w3m-search-name-anchor (name &optional quiet)
   (interactive "sName: ")
@@ -5437,6 +5450,7 @@
 	(setq ov (make-overlay beg pos))
 	(overlay-put ov 'face 'w3m-current-anchor-face)
 	(overlay-put ov 'w3m-momentary-overlay t)
+	(overlay-put ov 'evaporate t)
 	t))))
 
 (defun w3m-highlight-current-anchor ()
@@ -5450,7 +5464,8 @@
 				       ovs nil))
 			     (setq ovs (cdr ovs)))
 			   ov))))
-    (w3m-delete-all-overlays)
+; jet
+;    (w3m-delete-all-overlays)
     (save-excursion
       (let ((seq (w3m-anchor-sequence))
 	    (pos (point)))
Index: w3m-e21.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-e21.el,v
retrieving revision 1.133
diff -u -r1.133 w3m-e21.el
--- w3m-e21.el	1 Mar 2004 03:13:40 -0000	1.133
+++ w3m-e21.el	7 Apr 2004 11:46:02 -0000
@@ -337,9 +337,10 @@
 		 (insert " ")
 		 (setq start (1+ start)
 		       end (1- end)))))
-	(widget-convert-button
-	 'w3m-form-button start end
-	 :w3m-form-action (plist-get properties 'w3m-action))
+	(let ((w (widget-convert-button
+		  'w3m-form-button start end
+		  :w3m-form-action (plist-get properties 'w3m-action))))
+	  (overlay-put (widget-get w :button-overlay) 'evaporate t))
 	(add-text-properties start end properties))
     (add-text-properties start end (append '(face w3m-form-face)
 					   properties))))
Index: w3m-bitmap.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-bitmap.el,v
retrieving revision 1.32
diff -u -r1.32 w3m-bitmap.el
--- w3m-bitmap.el	5 Nov 2003 12:40:28 -0000	1.32
+++ w3m-bitmap.el	7 Apr 2004 11:46:02 -0000
@@ -298,6 +298,7 @@
 	(setq ovr (make-overlay ovrbeg ovrbeg))
 	(overlay-put ovr 'w3m-bitmap-image-line t)
 	(overlay-put ovr 'w3m-bitmap-image-count 0)
+	(overlay-put ovr 'evaporate t)
 	(w3m-static-when (= emacs-major-version 20)
 	  ;; Make the overlay transparent to the face text property.
 	  (overlay-put ovr 'face '((:background) (:foreground)))))