Gnus development mailing list
 help / color / mirror / Atom feed
From: Naohiro Aota <nao.aota@gmail.com>
To: jidanni@jidanni.org
Cc: emacs-w3m@namazu.org, ding@gnus.org
Subject: [emacs-w3m:10493] Re: nnrss vs. copy link location
Date: Thu, 04 Dec 2008 02:17:42 +0900 (JST)	[thread overview]
Message-ID: <20081204.021742.256018989115879870.nao.aota@gmail.com> (raw)
In-Reply-To: <87prkaf5dp.fsf@jidanni.org>

From: jidanni@jidanni.org
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@gmail.com>

	* 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 ()



  parent reply	other threads:[~2008-12-03 17:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-03  0:51 jidanni
2008-12-03  2:18 ` Robert D. Crawford
2008-12-03  3:26   ` jidanni
2008-12-03 17:17 ` Naohiro Aota [this message]
2008-12-03 19:21   ` jidanni
2008-12-04  1:58   ` [emacs-w3m:10503] " Katsumi Yamaoka
2008-12-04 20:14     ` Reiner Steib
2008-12-04 22:14       ` [emacs-w3m:10509] " Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081204.021742.256018989115879870.nao.aota@gmail.com \
    --to=nao.aota@gmail.com \
    --cc=ding@gnus.org \
    --cc=emacs-w3m@namazu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).