all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* respect active region in browse-url.el
@ 2004-05-22  6:55 Yoichi NAKAYAMA
  2004-05-23 18:28 ` Richard Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Yoichi NAKAYAMA @ 2004-05-22  6:55 UTC (permalink / raw)


Hi,

Url in text sometimes splits into lines and
`browse-url-url-at-point' detects only a part.
Following change enables a user to explicitly
specify url string part in text.

emacs-w3m (http://emacs-w3m.namazu.org/index-en.html)
has such feature and I'm using it conveniently.

Index: browse-url.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/browse-url.el,v
retrieving revision 1.36
diff -u -r1.36 browse-url.el
--- browse-url.el	27 Apr 2004 14:03:10 -0000	1.36
+++ browse-url.el	22 May 2004 06:33:58 -0000
@@ -583,7 +583,13 @@
 negation if a prefix argument was given."
   (let ((event (elt (this-command-keys) 0)))
     (and (listp event) (mouse-set-point event)))
-  (list (read-string prompt (browse-url-url-at-point))
+  (list (read-string prompt (or (and transient-mark-mode mark-active
+				     ;; rfc2396 Appendix E.
+				     (replace-regexp-in-string
+				      "[\t\r\f\n ]+" ""
+				      (buffer-substring-no-properties
+				       (region-beginning) (region-end))))
+				(browse-url-url-at-point)))
 	(not (eq (null browse-url-new-window-flag)
 		 (null current-prefix-arg)))))
 

Reference: http://www.faqs.org/rfcs/rfc2396.html

Regards,
-- 
Yoichi NAKAYAMA

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: respect active region in browse-url.el
  2004-05-22  6:55 respect active region in browse-url.el Yoichi NAKAYAMA
@ 2004-05-23 18:28 ` Richard Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2004-05-23 18:28 UTC (permalink / raw)
  Cc: emacs-devel

Your change looks good.  Would someone please install it?


Index: browse-url.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/browse-url.el,v
retrieving revision 1.36
diff -u -r1.36 browse-url.el
--- browse-url.el	27 Apr 2004 14:03:10 -0000	1.36
+++ browse-url.el	22 May 2004 06:33:58 -0000
@@ -583,7 +583,13 @@
 negation if a prefix argument was given."
   (let ((event (elt (this-command-keys) 0)))
     (and (listp event) (mouse-set-point event)))
-  (list (read-string prompt (browse-url-url-at-point))
+  (list (read-string prompt (or (and transient-mark-mode mark-active
+				     ;; rfc2396 Appendix E.
+				     (replace-regexp-in-string
+				      "[\t\r\f\n ]+" ""
+				      (buffer-substring-no-properties
+				       (region-beginning) (region-end))))
+				(browse-url-url-at-point)))
 	(not (eq (null browse-url-new-window-flag)
 		 (null current-prefix-arg)))))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-23 18:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-22  6:55 respect active region in browse-url.el Yoichi NAKAYAMA
2004-05-23 18:28 ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.