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

Re: w3m doesn't display messages with text/html mime-type properly



Hi,

I think the main problem is that emacs-w3m doesn't support the
widget buttons.  Then, I tried to make emacs-w3m imitate widget
buttons.  It's an imitation but also a real widget button.  You
can move about in a Gnus article buffer using TAB key seamlessly.
Is it what you want? :)

A patch for the emacs-w3m v1.3.3 release is attached below:
--- emacs-w3m-1.3.3/w3m.el~	2002-10-25 05:55:02 +0000
+++ emacs-w3m-1.3.3/w3m.el	2003-04-30 09:02:20 +0000
@@ -128,11 +128,13 @@
   (autoload 'w3m-cookie "w3m-cookie")
   (autoload 'w3m-about-cookie "w3m-cookie")
   (autoload 'w3m-cookie-shutdown "w3m-cookie" nil t)
-  (autoload 'report-emacs-w3m-bug "w3m-bug" nil t))
+  (autoload 'report-emacs-w3m-bug "w3m-bug" nil t)
+  (autoload 'widget-forward "wid-edit" nil t))
 
 ;; Avoid byte-compile warnings.
 (eval-when-compile
-  (autoload 'rfc2368-parse-mailto-url "rfc2368"))
+  (autoload 'rfc2368-parse-mailto-url "rfc2368")
+  (autoload 'widget-convert-button "wid-edit"))
 
 (defconst emacs-w3m-version "1.3.3"
   "Version number of this package.")
@@ -1119,6 +1121,12 @@
 		       (choice (string :tag "Replacement")
 			       (function :tag "Function")))))
 
+(defcustom w3m-imitate-widget-button t
+  "If non-nil, imitate the widget button on link (anchor) buttons.
+It is useful for moving about in a Gnus article buffer using TAB key."
+  :group 'w3m
+  :type 'boolean)
+
 (eval-and-compile
   (defconst w3m-entity-alist		; html character entities and values
     (eval-when-compile
@@ -2186,6 +2194,13 @@
 					   'w3m-anchor-sequence hseq
 					   'help-echo help
 					   'balloon-help balloon))
+	    (when w3m-imitate-widget-button
+	      (require 'wid-edit)
+	      (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)))
 	    (when name
 	      (w3m-add-text-properties start (point-max)
 				       (list 'w3m-name-anchor
@@ -4501,10 +4516,12 @@
       (w3m-previous-anchor (- arg))
     (while (> arg 0)
       (unless (w3m-goto-next-anchor)
-	;; search from the beginning of the buffer
 	(setq w3m-goto-anchor-hist nil)
-	(goto-char (point-min))
-	(w3m-goto-next-anchor))
+	(if w3m-imitate-widget-button
+	    (widget-forward 1)
+	  ;; search from the beginning of the buffer
+	  (goto-char (point-min))
+	  (w3m-goto-next-anchor)))
       (setq arg (1- arg))
       (if (member (w3m-anchor-sequence) w3m-goto-anchor-hist)
 	  (setq arg (1+ arg))
@@ -4547,10 +4564,12 @@
       (w3m-next-anchor (- arg))
     (while (> arg 0)
       (unless (w3m-goto-previous-anchor)
-	;; search from the end of the buffer
 	(setq w3m-goto-anchor-hist nil)
-	(goto-char (point-max))
-	(w3m-goto-previous-anchor))
+	(if w3m-imitate-widget-button
+	    (widget-forward -1)
+	  ;; search from the end of the buffer
+	  (goto-char (point-max))
+	  (w3m-goto-previous-anchor)))
       (setq arg (1- arg))
       (if (member (w3m-anchor-sequence) w3m-goto-anchor-hist)
 	  (setq arg (1+ arg))