* bug#19130: 25.0.50; [PATCH] eww.el: Allow user to easily follow link in fresh eww buffer
@ 2014-11-20 22:57 Andrey Kotlarski
2014-11-23 17:08 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Kotlarski @ 2014-11-20 22:57 UTC (permalink / raw)
To: 19130
For eww-browse-url to be proper alternative in/as
browse-url-browser-function, it should implement opening in new buffer,
just like w3m-browse-url, w3-browse-url etc. Following patch also
changes eww-follow-link to optionally make use of this. Changed single
prefix to open in new eww buffer and double prefix to open externally,
because it seems like natural progression.
---
lisp/ChangeLog | 6 ++++++
lisp/net/eww.el | 23 ++++++++++++++++-------
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 473a1f8..59afb2e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-20 Andrey Kotlarski <m00naticus@gmail.com>
+
+ * net/eww.el (eww-browse-url): Optionally create new eww buffer.
+ (eww-follow-link): Follow in new buffer in case of prefix
+ argument, open externally with double prefix.
+
2014-11-20 Eric S. Raymond <esr@snark>
* vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el, vc/vc-git.el,
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 6746668..9b6f779 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -624,10 +624,18 @@ the like."
(setq buffer-read-only t))
;;;###autoload
-(defun eww-browse-url (url &optional _new-window)
- (when (and (equal major-mode 'eww-mode)
- (plist-get eww-data :url))
- (eww-save-history))
+(defun eww-browse-url (url &optional new-window)
+ (cond (new-window
+ (let ((new-buffer "*eww*")
+ (num 0))
+ (while (get-buffer new-buffer)
+ (setq num (1+ num)
+ new-buffer (format "*eww*<%d>" num)))
+ (switch-to-buffer new-buffer))
+ (eww-mode))
+ ((and (equal major-mode 'eww-mode)
+ (plist-get eww-data :url))
+ (eww-save-history)))
(eww url))
(defun eww-back-url ()
@@ -1238,7 +1246,8 @@ The browser to used is specified by the `shr-external-browser' variable."
(defun eww-follow-link (&optional external mouse-event)
"Browse the URL under point.
-If EXTERNAL, browse the URL using `shr-external-browser'."
+If EXTERNAL is single prefix, browse in new buffer.
+If EXTERNAL is double prefix, browse the URL using `shr-external-browser'."
(interactive (list current-prefix-arg last-nonmenu-event))
(mouse-set-point mouse-event)
(let ((url (get-text-property (point) 'shr-url)))
@@ -1247,7 +1256,7 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
(message "No link under point"))
((string-match "^mailto:" url)
(browse-url-mail url))
- (external
+ ((and (consp external) (< 4 (car external)))
(funcall shr-external-browser url))
;; This is a #target url in the same page as the current one.
((and (url-target (url-generic-parse-url url))
@@ -1256,7 +1265,7 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
(eww-display-html 'utf-8 url (plist-get eww-data :url)
nil (current-buffer)))
(t
- (eww-browse-url url)))))
+ (eww-browse-url url external)))))
(defun eww-same-page-p (url1 url2)
"Return non-nil if both URLs represent the same page.
--
2.1.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#19130: 25.0.50; [PATCH] eww.el: Allow user to easily follow link in fresh eww buffer
2014-11-20 22:57 bug#19130: 25.0.50; [PATCH] eww.el: Allow user to easily follow link in fresh eww buffer Andrey Kotlarski
@ 2014-11-23 17:08 ` Lars Magne Ingebrigtsen
2014-11-23 17:25 ` Andrey Kotlarski
0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-23 17:08 UTC (permalink / raw)
To: Andrey Kotlarski; +Cc: 19130
Andrey Kotlarski <m00naticus@gmail.com> writes:
> For eww-browse-url to be proper alternative in/as
> browse-url-browser-function, it should implement opening in new buffer,
> just like w3m-browse-url, w3-browse-url etc. Following patch also
> changes eww-follow-link to optionally make use of this. Changed single
> prefix to open in new eww buffer and double prefix to open externally,
> because it seems like natural progression.
Looks good. Do you have FSF copyright assignment papers for Emacs on
file?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#19130: 25.0.50; [PATCH] eww.el: Allow user to easily follow link in fresh eww buffer
2014-11-23 17:08 ` Lars Magne Ingebrigtsen
@ 2014-11-23 17:25 ` Andrey Kotlarski
2014-11-23 17:30 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Kotlarski @ 2014-11-23 17:25 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen; +Cc: 19130
[ 23 ноември 2014, 18:08 +0100, неделя ] Lars Magne Ingebrigtsen:
> Looks good. Do you have FSF copyright assignment papers for Emacs on
> file?
Yes, signed and confirmed year ago.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#19130: 25.0.50; [PATCH] eww.el: Allow user to easily follow link in fresh eww buffer
2014-11-23 17:25 ` Andrey Kotlarski
@ 2014-11-23 17:30 ` Lars Magne Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-23 17:30 UTC (permalink / raw)
To: Andrey Kotlarski; +Cc: 19130
Andrey Kotlarski <m00naticus@gmail.com> writes:
> [ 23 ноември 2014, 18:08 +0100, неделя ] Lars Magne Ingebrigtsen:
>
>> Looks good. Do you have FSF copyright assignment papers for Emacs on
>> file?
>
> Yes, signed and confirmed year ago.
Ok; applied.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-23 17:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 22:57 bug#19130: 25.0.50; [PATCH] eww.el: Allow user to easily follow link in fresh eww buffer Andrey Kotlarski
2014-11-23 17:08 ` Lars Magne Ingebrigtsen
2014-11-23 17:25 ` Andrey Kotlarski
2014-11-23 17:30 ` Lars Magne Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).