Changes committed gnus/lisp (ChangeLog gnus-art.el lpath.el mm-view.el)

"Katsumi Yamaoka" <[email protected]> Thu, 04 Dec 2008 02:58:21 +0100
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog gnus-art.el lpath.el mm-view.el

* mm-view.el (mm-inline-text-html-render-with-w3m): Put special keymap on links.
* gnus-art.el (gnus-article-wash-html-with-w3m): Ditto.
* lpath.el: Bind w3m-link-map for Emacs 21, 22, and XEmacs.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1936 gnus/lisp/ChangeLog:7.1937
--- ChangeLog:7.1936	Wed Dec  3 21:33:34 2008
+++ ChangeLog	Thu Dec  4 02:58:21 2008
@@ -1,3 +1,12 @@
+2008-12-04  Naohiro Aota  <[email protected]>
+
+	* mm-view.el (mm-inline-text-html-render-with-w3m): Put special keymap
+	on links.
+
+	* gnus-art.el (gnus-article-wash-html-with-w3m): Ditto.
+
+	* lpath.el: Bind w3m-link-map for Emacs 21, 22, and XEmacs.
+
 2008-12-03  Stefan Monnier  <[email protected]>
 
 	* nnimap.el (nnimap-retrieve-headers-progress): Don't use nnimap-demule
Index: gnus-art.el
diff -u gnus/lisp/gnus-art.el:7.283 gnus/lisp/gnus-art.el:7.284
--- gnus-art.el:7.283	Fri Oct  3 06:21:54 2008
+++ gnus-art.el	Thu Dec  4 02:58:21 2008
@@ -2731,11 +2731,34 @@
   (when (and mm-inline-text-html-with-w3m-keymap
 	     (boundp 'w3m-minor-mode-map)
 	     w3m-minor-mode-map)
-    (add-text-properties
-     (point-min) (point-max)
-     (list 'keymap w3m-minor-mode-map
-	   ;; Put the mark meaning this part was rendered by emacs-w3m.
-	   'mm-inline-text-html-with-w3m t))))
+    (if (and (boundp 'w3m-link-map)
+	     w3m-link-map)
+	(let ((begin (point-min))
+	      (map (copy-keymap w3m-link-map))
+	      end)
+	  (set-keymap-parent map w3m-minor-mode-map)
+	  (while (setq end (next-single-property-change begin
+							'w3m-href-anchor))
+	    (add-text-properties
+	     begin end
+	     (list 'keymap (if (get-text-property begin 'w3m-href-anchor)
+			       map
+			     w3m-minor-mode-map)
+		   ;; Put the mark meaning this part was rendered by emacs-w3m.
+		   'mm-inline-text-html-with-w3m t))
+	    (setq begin end))
+	  (add-text-properties
+	   begin (point-max)
+	   (list 'keymap (if (get-text-property begin 'w3m-href-anchor)
+			     map
+			   w3m-minor-mode-map)
+		 ;; Put the mark meaning this part was rendered by emacs-w3m.
+		 'mm-inline-text-html-with-w3m t)))
+      (add-text-properties
+       (point-min) (point-max)
+       (list 'keymap w3m-minor-mode-map
+	     ;; Put the mark meaning this part was rendered by emacs-w3m.
+	     'mm-inline-text-html-with-w3m t)))))
 
 (defvar charset) ;; Bound by `article-wash-html'.
 
Index: lpath.el
diff -u gnus/lisp/lpath.el:7.48 gnus/lisp/lpath.el:7.49
--- lpath.el:7.48	Fri Oct  3 08:58:08 2008
+++ lpath.el	Thu Dec  4 02:58:21 2008
@@ -22,7 +22,9 @@
        Info-index-next Info-menu bbdb-complete-name display-time-event-handler
        epg-check-configuration find-coding-system frame-device w3-do-setup
        w3-prepare-buffer w3-region w32-focus-frame w3m-detect-meta-charset
-       w3m-region)))
+       w3m-region))
+    (maybe-bind
+     '(w3m-link-map)))
 
   (when (= emacs-major-version 21)
     (defun split-line (&optional arg))
@@ -71,7 +73,7 @@
      mouse-selection-click-count-buffer ps-print-color-p
      rmail-insert-mime-forwarded-message-function
      show-trailing-whitespace tool-bar-mode transient-mark-mode
-     url-version w3-meta-charset-content-type-regexp
+     url-version w3-meta-charset-content-type-regexp w3m-link-map
      w3-meta-content-type-charset-regexp))
 
   (when (or (and (= emacs-major-version 21) (= emacs-minor-version 4))
Index: mm-view.el
diff -u gnus/lisp/mm-view.el:7.59 gnus/lisp/mm-view.el:7.60
--- mm-view.el:7.59	Mon Sep 22 12:34:03 2008
+++ mm-view.el	Thu Dec  4 02:58:21 2008
@@ -261,11 +261,37 @@
 	(when (and mm-inline-text-html-with-w3m-keymap
 		   (boundp 'w3m-minor-mode-map)
 		   w3m-minor-mode-map)
-	  (add-text-properties
-	   (point-min) (point-max)
-	   (list 'keymap w3m-minor-mode-map
-		 ;; Put the mark meaning this part was rendered by emacs-w3m.
-		 'mm-inline-text-html-with-w3m t)))
+	  (if (and (boundp 'w3m-link-map)
+		   w3m-link-map)
+	      (let ((begin (point-min))
+		    (map (copy-keymap w3m-link-map))
+		    end)
+		(set-keymap-parent map w3m-minor-mode-map)
+		(while (setq end (next-single-property-change
+				  begin 'w3m-href-anchor))
+		  (add-text-properties
+		   begin end
+		   (list 'keymap (if (get-text-property begin 'w3m-href-anchor)
+				     map
+				   w3m-minor-mode-map)
+			 ;; Put the mark meaning this part was rendered
+			 ;; by emacs-w3m.
+			 'mm-inline-text-html-with-w3m t))
+		  (setq begin end))
+		(add-text-properties
+		 begin (point-max)
+		 (list 'keymap (if (get-text-property begin 'w3m-href-anchor)
+				   map
+				 w3m-minor-mode-map)
+		       ;; Put the mark meaning this part was rendered
+		       ;; by emacs-w3m.
+		       'mm-inline-text-html-with-w3m t)))
+	    (add-text-properties
+	     (point-min) (point-max)
+	     (list 'keymap w3m-minor-mode-map
+		   ;; Put the mark meaning this part was rendered
+		   ;; by emacs-w3m.
+		   'mm-inline-text-html-with-w3m t))))
 	(mm-handle-set-undisplayer
 	 handle
 	 `(lambda ()