aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2011-11-03 22:25:57 +0100
committerJoakim Verona2011-11-03 22:25:57 +0100
commite40ee7bd1eac05291eb99306f8b7afc7637e9064 (patch)
treed595dcee4dd86760181816af6ce6194ec9128055
parent85a3fca5206d1a2bc466cdb5d8817e1bf69b8820 (diff)
downloademacs-e40ee7bd1eac05291eb99306f8b7afc7637e9064.tar.gz
emacs-e40ee7bd1eac05291eb99306f8b7afc7637e9064.zip
improvement to 'g'
-rw-r--r--README.xwidget8
-rw-r--r--lisp/net/browse-url.el5
-rw-r--r--lisp/xwidget.el6
3 files changed, 15 insertions, 4 deletions
diff --git a/README.xwidget b/README.xwidget
index f1b3e245dc5..5b0bfcd91f3 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -1476,3 +1476,11 @@ VirtualBox images to test with.
1476 CLOSED: [2011-11-01 Tue 11:19] 1476 CLOSED: [2011-11-01 Tue 11:19]
1477http://www.youtube.com/watch?v=DZdUgjEx_dQ&html5=1 1477http://www.youtube.com/watch?v=DZdUgjEx_dQ&html5=1
1478html5 makes it work without stupid flash plugins! 1478html5 makes it work without stupid flash plugins!
1479** TODO clicking on an webkit xwidgets
1480doesn't make the window active. this leads to problems.
1481** DONE "g" should default to current url
1482 CLOSED: [2011-11-03 Thu 22:25]
1483"g" runs xwidget-webkit-browse-url which gets its interactive argument
1484from browse-url-interactive-arg. this might need a new optional argument.
1485
1486http://test
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 39a48bde645..87e772f1833 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -669,7 +669,7 @@ regarding its parameter treatment."
669;; functions allows them to be stand-alone commands, making it easier 669;; functions allows them to be stand-alone commands, making it easier
670;; to switch between browsers. 670;; to switch between browsers.
671 671
672(defun browse-url-interactive-arg (prompt) 672(defun browse-url-interactive-arg (prompt &optional default-url)
673 "Read a URL from the minibuffer, prompting with PROMPT. 673 "Read a URL from the minibuffer, prompting with PROMPT.
674If `transient-mark-mode' is non-nil and the mark is active, 674If `transient-mark-mode' is non-nil and the mark is active,
675it defaults to the current region, else to the URL at or before 675it defaults to the current region, else to the URL at or before
@@ -686,7 +686,8 @@ for use in `interactive'."
686 "[\t\r\f\n ]+" "" 686 "[\t\r\f\n ]+" ""
687 (buffer-substring-no-properties 687 (buffer-substring-no-properties
688 (region-beginning) (region-end)))) 688 (region-beginning) (region-end))))
689 (browse-url-url-at-point))) 689 (browse-url-url-at-point)
690 default-url))
690 (not (eq (null browse-url-new-window-flag) 691 (not (eq (null browse-url-new-window-flag)
691 (null current-prefix-arg))))) 692 (null current-prefix-arg)))))
692 693
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index e89f074280d..0225889811d 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -72,7 +72,7 @@ NEW-SESSION specifies whether to create a new xwidget-webkit session. URL
72defaults to the string looking like a url around the cursor position." 72defaults to the string looking like a url around the cursor position."
73 (interactive (progn 73 (interactive (progn
74 (require 'browse-url) 74 (require 'browse-url)
75 (browse-url-interactive-arg "xwidget-webkit URL: "))) 75 (browse-url-interactive-arg "xwidget-webkit URL: " ( xwidget-webkit-current-url))))
76 (when (stringp url) 76 (when (stringp url)
77 (setq url (url-tidy url)) 77 (setq url (url-tidy url))
78 (if new-session 78 (if new-session
@@ -337,7 +337,9 @@ Argument H height."
337(defun xwidget-webkit-current-url () 337(defun xwidget-webkit-current-url ()
338 "Get the webkit url. place it on kill ring." 338 "Get the webkit url. place it on kill ring."
339 (interactive) 339 (interactive)
340 (message "url: %s" (kill-new (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session) "document.URL")))) 340 (let ((url (kill-new (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session) "document.URL"))))
341 (message "url: %s" url )
342 url))
341 343
342(defun xwidget-webkit-execute-script-rv (xw script &optional default) 344(defun xwidget-webkit-execute-script-rv (xw script &optional default)
343 "same as xwidget-webkit-execute-script but also wraps an ugly hack to return a value" 345 "same as xwidget-webkit-execute-script but also wraps an ugly hack to return a value"