# HG changeset patch # User Juanma Barranquero # Date 1085351759 0 # Node ID 5806629f98483de34f676af3371e9c714a19d99b # Parent 11d33fd7f8c4ffcaa9083a62830a4e24d00fdc43 (browse-url-interactive-arg): Enable user to explicitly select the text to be taken as URL. diff -r 11d33fd7f8c4 -r 5806629f9848 lisp/net/browse-url.el --- a/lisp/net/browse-url.el Sun May 23 21:05:08 2004 +0000 +++ b/lisp/net/browse-url.el Sun May 23 22:35:59 2004 +0000 @@ -577,13 +577,21 @@ (defun browse-url-interactive-arg (prompt) "Read a URL from the minibuffer, prompting with PROMPT. -Default to the URL at or before point. If invoked with a mouse button, -set point to the position clicked first. Return a list for use in -`interactive' containing the URL and `browse-url-new-window-flag' or its +If `transient-mark-mode' is non-nil and the mark is active, +defaults to the current region, else to the URL at or before +point. If invoked with a mouse button, set point to the +position clicked first. Return a list for use in `interactive' +containing the URL and `browse-url-new-window-flag' or its 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)))))