1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

improvement to 'g'

This commit is contained in:
Joakim Verona 2011-11-03 22:25:57 +01:00
parent 85a3fca520
commit e40ee7bd1e
3 changed files with 15 additions and 4 deletions

View file

@ -1476,3 +1476,11 @@ VirtualBox images to test with.
CLOSED: [2011-11-01 Tue 11:19] CLOSED: [2011-11-01 Tue 11:19]
http://www.youtube.com/watch?v=DZdUgjEx_dQ&html5=1 http://www.youtube.com/watch?v=DZdUgjEx_dQ&html5=1
html5 makes it work without stupid flash plugins! html5 makes it work without stupid flash plugins!
** TODO clicking on an webkit xwidgets
doesn't make the window active. this leads to problems.
** DONE "g" should default to current url
CLOSED: [2011-11-03 Thu 22:25]
"g" runs xwidget-webkit-browse-url which gets its interactive argument
from browse-url-interactive-arg. this might need a new optional argument.
http://test

View file

@ -669,7 +669,7 @@ regarding its parameter treatment."
;; functions allows them to be stand-alone commands, making it easier ;; functions allows them to be stand-alone commands, making it easier
;; to switch between browsers. ;; to switch between browsers.
(defun browse-url-interactive-arg (prompt) (defun browse-url-interactive-arg (prompt &optional default-url)
"Read a URL from the minibuffer, prompting with PROMPT. "Read a URL from the minibuffer, prompting with PROMPT.
If `transient-mark-mode' is non-nil and the mark is active, If `transient-mark-mode' is non-nil and the mark is active,
it defaults to the current region, else to the URL at or before it defaults to the current region, else to the URL at or before
@ -686,7 +686,8 @@ for use in `interactive'."
"[\t\r\f\n ]+" "" "[\t\r\f\n ]+" ""
(buffer-substring-no-properties (buffer-substring-no-properties
(region-beginning) (region-end)))) (region-beginning) (region-end))))
(browse-url-url-at-point))) (browse-url-url-at-point)
default-url))
(not (eq (null browse-url-new-window-flag) (not (eq (null browse-url-new-window-flag)
(null current-prefix-arg))))) (null current-prefix-arg)))))

View file

@ -72,7 +72,7 @@ NEW-SESSION specifies whether to create a new xwidget-webkit session. URL
defaults to the string looking like a url around the cursor position." defaults to the string looking like a url around the cursor position."
(interactive (progn (interactive (progn
(require 'browse-url) (require 'browse-url)
(browse-url-interactive-arg "xwidget-webkit URL: "))) (browse-url-interactive-arg "xwidget-webkit URL: " ( xwidget-webkit-current-url))))
(when (stringp url) (when (stringp url)
(setq url (url-tidy url)) (setq url (url-tidy url))
(if new-session (if new-session
@ -337,7 +337,9 @@ Argument H height."
(defun xwidget-webkit-current-url () (defun xwidget-webkit-current-url ()
"Get the webkit url. place it on kill ring." "Get the webkit url. place it on kill ring."
(interactive) (interactive)
(message "url: %s" (kill-new (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session) "document.URL")))) (let ((url (kill-new (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session) "document.URL"))))
(message "url: %s" url )
url))
(defun xwidget-webkit-execute-script-rv (xw script &optional default) (defun xwidget-webkit-execute-script-rv (xw script &optional default)
"same as xwidget-webkit-execute-script but also wraps an ugly hack to return a value" "same as xwidget-webkit-execute-script but also wraps an ugly hack to return a value"