diff options
| author | Rüdiger Sonderfeld | 2013-12-01 16:44:25 +0100 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-12-01 16:44:25 +0100 |
| commit | b2afb3ea3e5be8f056b896f20d56dedd932b50c2 (patch) | |
| tree | 488a93d79655eea04ffe0ef4273044e7820f8ac7 | |
| parent | eb2dd24d5b5c871f0b38667f460e4efd23fde799 (diff) | |
| download | emacs-b2afb3ea3e5be8f056b896f20d56dedd932b50c2.tar.gz emacs-b2afb3ea3e5be8f056b896f20d56dedd932b50c2.zip | |
Option to always use external-browser for certain content.
* net/eww.el (eww-use-external-browser-for-content-type): New
variable.
(eww-render): Handle `eww-use-external-browser-for-content-type'.
Use \\` to match beginning of string instead of ^.
(eww-browse-with-external-browser): Provide optional URL parameter.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/net/eww.el | 22 |
2 files changed, 23 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8efa64bd7e6..a6340b7fd03 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2013-12-01 Rüdiger Sonderfeld <ruediger@c-plusplus.de> | 1 | 2013-12-01 Rüdiger Sonderfeld <ruediger@c-plusplus.de> |
| 2 | 2 | ||
| 3 | * net/eww.el (eww-use-external-browser-for-content-type): New | ||
| 4 | variable. | ||
| 5 | (eww-render): Handle `eww-use-external-browser-for-content-type'. | ||
| 6 | Use \\` to match beginning of string instead of ^. | ||
| 7 | (eww-browse-with-external-browser): Provide optional URL parameter. | ||
| 8 | |||
| 3 | * net/shr.el (shr-tag-video): Display content for video if no | 9 | * net/shr.el (shr-tag-video): Display content for video if no |
| 4 | poster is available. | 10 | poster is available. |
| 5 | (shr-tag-audio): Add support for <audio> tag. | 11 | (shr-tag-audio): Add support for <audio> tag. |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 2f481c31b15..ca7bf60f1a4 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -56,6 +56,14 @@ | |||
| 56 | :group 'eww | 56 | :group 'eww |
| 57 | :type 'string) | 57 | :type 'string) |
| 58 | 58 | ||
| 59 | (defcustom eww-use-external-browser-for-content-type | ||
| 60 | "\\`\\(video/\\|audio/\\|application/ogg\\)" | ||
| 61 | "Always use external browser for specified content-type." | ||
| 62 | :version "24.4" | ||
| 63 | :group 'eww | ||
| 64 | :type '(choice (const :tag "Never" nil) | ||
| 65 | regexp)) | ||
| 66 | |||
| 59 | (defface eww-form-submit | 67 | (defface eww-form-submit |
| 60 | '((((type x w32 ns) (class color)) ; Like default mode line | 68 | '((((type x w32 ns) (class color)) ; Like default mode line |
| 61 | :box (:line-width 2 :style released-button) | 69 | :box (:line-width 2 :style released-button) |
| @@ -162,11 +170,15 @@ word(s) will be searched for via `eww-search-prefix'." | |||
| 162 | (unwind-protect | 170 | (unwind-protect |
| 163 | (progn | 171 | (progn |
| 164 | (cond | 172 | (cond |
| 173 | ((and eww-use-external-browser-for-content-type | ||
| 174 | (string-match-p eww-use-external-browser-for-content-type | ||
| 175 | (car content-type))) | ||
| 176 | (eww-browse-with-external-browser url)) | ||
| 165 | ((equal (car content-type) "text/html") | 177 | ((equal (car content-type) "text/html") |
| 166 | (eww-display-html charset url nil point)) | 178 | (eww-display-html charset url nil point)) |
| 167 | ((string-match "^image/" (car content-type)) | 179 | ((string-match-p "\\`image/" (car content-type)) |
| 168 | (eww-display-image) | 180 | (eww-display-image url)) |
| 169 | (eww-update-header-line-format)) | 181 | (eww-update-header-line-format)) |
| 170 | (t | 182 | (t |
| 171 | (eww-display-raw) | 183 | (eww-display-raw) |
| 172 | (eww-update-header-line-format))) | 184 | (eww-update-header-line-format))) |
| @@ -938,11 +950,11 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") | |||
| 938 | "?" | 950 | "?" |
| 939 | (mm-url-encode-www-form-urlencoded values)))))) | 951 | (mm-url-encode-www-form-urlencoded values)))))) |
| 940 | 952 | ||
| 941 | (defun eww-browse-with-external-browser () | 953 | (defun eww-browse-with-external-browser (&optional url) |
| 942 | "Browse the current URL with an external browser. | 954 | "Browse the current URL with an external browser. |
| 943 | The browser to used is specified by the `shr-external-browser' variable." | 955 | The browser to used is specified by the `shr-external-browser' variable." |
| 944 | (interactive) | 956 | (interactive) |
| 945 | (funcall shr-external-browser eww-current-url)) | 957 | (funcall shr-external-browser (or url eww-current-url))) |
| 946 | 958 | ||
| 947 | (defun eww-follow-link (&optional external mouse-event) | 959 | (defun eww-follow-link (&optional external mouse-event) |
| 948 | "Browse the URL under point. | 960 | "Browse the URL under point. |