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

Re: nnrss vs. copy link location



From: jidanni@xxxxxxxxxxx
Subject: nnrss vs. copy link location
Date: Wed, 03 Dec 2008 08:51:14 +0800

I'm reading http://feedproxy.google.com/TorrentFreak in NNRSS, but
when I come across links like
<a href="http://torrentfreak.com/pirate-party-endorses-obama-080103/";>US Pirate Party</a>
there is no 'copy link location' etc. right click mouse keys etc. No
way to copy link location.

It seems that there is something wrong with Gnus.

mm-inline-text-html-render-with-w3m() in mm-view.el
.-------------------------------------------------------------------------------
|	(let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp)
|	      w3m-force-redisplay)
|	  (w3m-region (point-min) (point-max) nil charset))
`-------------------------------------------------------------------------------

Here, links' special keymap (w3m-link-map) is set.

.-------------------------------------------------------------------------------
|	(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)))
`-------------------------------------------------------------------------------

But here, the previous keymap is overridden. :(

Anyway, I wrote a patch to fix this problem. Could you check it?

Regards,
Naohiro Aota

2008-12-03  Naohiro Aota  <nao.aota@xxxxxxxxx>

* 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.

Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 7.283
diff -u -r7.283 gnus-art.el
--- lisp/gnus-art.el	3 Oct 2008 04:21:54 -0000	7.283
+++ lisp/gnus-art.el	3 Dec 2008 17:05:33 -0000
@@ -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: lisp/mm-view.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-view.el,v
retrieving revision 7.59
diff -u -r7.59 mm-view.el
--- lisp/mm-view.el	22 Sep 2008 10:34:03 -0000	7.59
+++ lisp/mm-view.el	3 Dec 2008 17:05:33 -0000
@@ -261,11 +261,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))))
	(mm-handle-set-undisplayer
	 handle
	 `(lambda ()