GNU bug report logs - #15707
[PATCH 5/8] EWW: Option to always use external-browser for certain content.

Previous Next

Package: emacs;

Reported by: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>

Date: Thu, 24 Oct 2013 23:45:06 UTC

Severity: normal

Tags: fixed, patch

Merged with 15702, 15703, 15704, 15705, 15706, 15708, 15709, 15710

Fixed in version 24.4

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15707 in the body.
You can then email your comments to 15707 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15707; Package emacs. (Thu, 24 Oct 2013 23:45:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Oct 2013 23:45:07 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: bug-gnu-emacs <at> gnu.org
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Subject: [PATCH 5/8] EWW: Option to always use external-browser for certain
 content.
Date: Fri, 25 Oct 2013 01:44 +0200
Emacs can not display videos and has only limited audio support.
Therefore it makes sense to call an external browser for links of that
kind.  This is also a problem because shr turns <video> and <audio>
tags into links to the media.

* lisp/net/eww.el (eww-use-external-browser-for-content-type): New
  customizable 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.

Signed-off-by: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
---
 lisp/net/eww.el | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index ccc2399..6335bd8 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -75,6 +75,14 @@ (defcustom eww-form-checkbox-symbol "[ ]"
                  (const "☐")            ; Unicode BALLOT BOX
                  string))
 
+(defcustom eww-use-external-browser-for-content-type
+  "\\`\\(video/\\|audio/\\|application/ogg\\)"
+  "Always use external browser for specified content-type."
+  :version "24.4"
+  :group 'eww
+  :type '(choice (const :tag "Never" nil)
+                 regexp))
+
 (defface eww-form-submit
   '((((type x w32 ns) (class color))	; Like default mode line
      :box (:line-width 2 :style released-button)
@@ -173,10 +181,14 @@ (defun eww-render (status url &optional point)
     (unwind-protect
 	(progn
 	  (cond
+           ((and eww-use-external-browser-for-content-type
+                 (string-match-p eww-use-external-browser-for-content-type
+                                 (car content-type)))
+            (eww-browse-with-external-browser url))
 	   ((equal (car content-type) "text/html")
 	    (eww-display-html charset url))
-	   ((string-match "^image/" (car content-type))
-	    (eww-display-image))
+	   ((string-match-p "\\`image/" (car content-type))
+	    (eww-display-image url))
 	   (t
 	    (eww-display-raw)))
 	  (setq eww-current-url url
@@ -929,11 +941,11 @@ (defun eww-submit ()
 	"?"
 	(mm-url-encode-www-form-urlencoded values))))))
 
-(defun eww-browse-with-external-browser ()
+(defun eww-browse-with-external-browser (&optional url)
   "Browse the current URL with an external browser.
 The browser to used is specified by the `shr-external-browser' variable."
   (interactive)
-  (funcall shr-external-browser eww-current-url))
+  (funcall shr-external-browser (or url eww-current-url)))
 
 (defun eww-copy-page-url ()
   (interactive)
-- 
1.8.4.1






Merged 15702 15703 15704 15705 15706 15707 15708 15709 15710. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 24 Oct 2013 23:55:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15707; Package emacs. (Sun, 01 Dec 2013 15:45:02 GMT) Full text and rfc822 format available.

Message #10 received at 15707 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Cc: 15708 <at> debbugs.gnu.org, 15707 <at> debbugs.gnu.org
Subject: Re: bug#15707: [PATCH 5/8] EWW: Option to always use external-browser
 for certain content.
Date: Sun, 01 Dec 2013 16:44:41 +0100
Rüdiger Sonderfeld <ruediger <at> c-plusplus.de> writes:

> Emacs can not display videos and has only limited audio support.
> Therefore it makes sense to call an external browser for links of that
> kind.  This is also a problem because shr turns <video> and <audio>
> tags into links to the media.
>
> * lisp/net/eww.el (eww-use-external-browser-for-content-type): New
>   customizable 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.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 01 Dec 2013 15:54:08 GMT) Full text and rfc822 format available.

bug marked as fixed in version 24.4, send any further explanations to 15708 <at> debbugs.gnu.org and Rüdiger Sonderfeld <ruediger <at> c-plusplus.de> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 01 Dec 2013 15:54:12 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Dec 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 230 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.