From 4c4939993a74ca113cf52872d749f13482bd8251 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 23 May 2004 22:38:30 +0000 Subject: [PATCH] (browse-url-interactive-arg): Enable user to explicitly select the text to be taken as URL. --- lisp/ChangeLog | 7 ++++++- lisp/net/browse-url.el | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1533d3aae18..6035f696952 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2004-05-24 Yoichi NAKAYAMA (tiny change) + + * net/browse-url.el (browse-url-interactive-arg): Enable user to + explicitly select the text to be taken as URL. + 2004-05-23 Juri Linkov * info.el (Info-index-nodes): New var and fun. @@ -69,7 +74,7 @@ * progmodes/gud.el (gud-menu-map, gud-speedbar-menu-items) (gud-speedbar-buttons, gud-sentinel, gud-display-line) (gud-basic-call): Handle new value for gud-minor-mode (gdbmi) for - a new mode. The file (gdb-mi.el) for this mode will be included + a new mode. The file (gdb-mi.el) for this mode will be included with the GDB distribution (6.2 onwards) and will use GDB/MI as its primary interface. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 8000e49c6d8..e98b3d815ab 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -577,13 +577,21 @@ down (this *won't* always work)." (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))))) -- 2.39.5