* [PATCH] eww improvements
@ 2013-06-23 16:58 Ivan Kanis
2013-06-23 18:29 ` Lars Magne Ingebrigtsen
2013-06-25 6:07 ` Juri Linkov
0 siblings, 2 replies; 17+ messages in thread
From: Ivan Kanis @ 2013-06-23 16:58 UTC (permalink / raw)
To: Lars Grunewaldt; +Cc: Emacs Development List
[-- Attachment #1: Type: text/plain, Size: 43 bytes --]
Lars,
I have attached 3 patches for eww.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-allow-entering-keywords-for-search-engine.patch --]
[-- Type: text/x-diff, Size: 1408 bytes --]
From dfb8f81cb0bc5915e2ffb45cd933b018e7f5d37e Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Sun, 23 Jun 2013 18:20:03 +0200
Subject: [PATCH 1/3] allow entering keywords for search engine
---
emacs/gnus/eww.el | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index ad19758..4fc9fe0 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -43,6 +43,11 @@
:group 'eww
:type 'string)
+(defcustom eww-search-prefix "https://duckduckgo.com/html/?q="
+ "Prefix URL to search engine"
+ :group 'eww
+ :type 'string)
+
(defface eww-form-submit
'((((type x w32 ns) (class color)) ; Like default mode line
:box (:line-width 2 :style released-button)
@@ -90,9 +95,13 @@
;;;###autoload
(defun eww (url)
"Fetch URL and render the page."
- (interactive "sUrl: ")
- (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
- (setq url (concat "http://" url)))
+ (interactive "sEnter URL or keywords: ")
+ (if (and (= (length (split-string url)) 1)
+ (> (length (split-string url "\\.")) 1))
+ (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
+ (setq url (concat "http://" url)))
+ (setq url (concat eww-search-prefix
+ (replace-regexp-in-string " " "+" url))))
(url-retrieve url 'eww-render (list url)))
;;;###autoload
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-w-key-launches-external-browser-for-current-page-url.patch --]
[-- Type: text/x-diff, Size: 1731 bytes --]
From 8e1cb8158dee5d7b65a2e04748fb0e47a7023cb2 Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Sun, 23 Jun 2013 18:44:40 +0200
Subject: [PATCH 2/3] 'w' key launches external browser for current page url
---
emacs/gnus/eww.el | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index 4fc9fe0..1b028b1 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -48,6 +48,12 @@
:group 'eww
:type 'string)
+(defcustom eww-external-browser 'browse-url-firefox
+ "Function called to launch external browser.
+It will be used when emacs runs on neither Windows or Mac."
+ :group 'eww
+ :type 'function)
+
(defface eww-form-submit
'((((type x w32 ns) (class color)) ; Like default mode line
:box (:line-width 2 :style released-button)
@@ -313,6 +319,7 @@
(define-key map "p" 'eww-previous-url)
(define-key map "u" 'eww-up-url)
(define-key map "t" 'eww-top-url)
+ (define-key map "w" 'eww-browse-with-external-browser)
map))
(define-derived-mode eww-mode nil "eww"
@@ -819,6 +826,19 @@ appears in a <link> or <a> tag."
"?"
(mm-url-encode-www-form-urlencoded values))))))
+(defun eww-browse-with-external-browser ()
+ "Browse URL with external browser.
+It support Windows and Mac then calls the function specified in
+ `eww-external-browser'."
+ (interactive)
+ (let ((url eww-current-url))
+ (cond ((eq system-type 'windows-nt)
+ (browse-url-default-windows-browser url))
+ ((eq system-type 'darwin)
+ (browse-url-default-macosx-browser url))
+ (t
+ (funcall eww-external-browser url)))))
+
(provide 'eww)
;;; eww.el ends here
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-C-c-C-c-submit-current-form.patch --]
[-- Type: text/x-diff, Size: 1898 bytes --]
From 885156af074991ab9a003a641ec1e82d46fc8d78 Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Sun, 23 Jun 2013 18:50:20 +0200
Subject: [PATCH 3/3] C-c C-c submit current form
---
emacs/gnus/eww.el | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index 1b028b1..959fc4d 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -405,12 +405,14 @@ appears in a <link> or <a> tag."
(defvar eww-submit-map
(let ((map (make-sparse-keymap)))
(define-key map "\r" 'eww-submit)
+ (define-key map [(control c) (control c)] 'eww-submit)
map))
(defvar eww-checkbox-map
(let ((map (make-sparse-keymap)))
(define-key map [space] 'eww-toggle-checkbox)
(define-key map "\r" 'eww-toggle-checkbox)
+ (define-key map [(control c) (control c)] 'eww-submit)
map))
(defvar eww-text-map
@@ -418,6 +420,7 @@ appears in a <link> or <a> tag."
(set-keymap-parent map text-mode-map)
(define-key map "\r" 'eww-submit)
(define-key map [(control a)] 'eww-beginning-of-text)
+ (define-key map [(control c) (control c)] 'eww-submit)
(define-key map [(control e)] 'eww-end-of-text)
(define-key map [tab] 'shr-next-link)
(define-key map [backtab] 'shr-previous-link)
@@ -427,6 +430,7 @@ appears in a <link> or <a> tag."
(let ((map (make-keymap)))
(set-keymap-parent map text-mode-map)
(define-key map "\r" 'forward-line)
+ (define-key map [(control c) (control c)] 'eww-submit)
(define-key map [tab] 'shr-next-link)
(define-key map [backtab] 'shr-previous-link)
map))
@@ -434,6 +438,7 @@ appears in a <link> or <a> tag."
(defvar eww-select-map
(let ((map (make-sparse-keymap)))
(define-key map "\r" 'eww-change-select)
+ (define-key map [(control c) (control c)] 'eww-submit)
map))
(defun eww-beginning-of-text ()
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-23 16:58 [PATCH] eww improvements Ivan Kanis
@ 2013-06-23 18:29 ` Lars Magne Ingebrigtsen
2013-06-23 21:48 ` Rüdiger Sonderfeld
2013-06-25 6:07 ` Juri Linkov
1 sibling, 1 reply; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-06-23 18:29 UTC (permalink / raw)
To: Ivan Kanis; +Cc: Lars Grunewaldt, Emacs Development List
Ivan Kanis <ivan@kanis.fr> writes:
> I have attached 3 patches for eww.
Thanks; all applied.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-23 18:29 ` Lars Magne Ingebrigtsen
@ 2013-06-23 21:48 ` Rüdiger Sonderfeld
2013-06-23 21:52 ` Lars Magne Ingebrigtsen
2013-06-24 5:24 ` Ivan Kanis
0 siblings, 2 replies; 17+ messages in thread
From: Rüdiger Sonderfeld @ 2013-06-23 21:48 UTC (permalink / raw)
To: emacs-devel; +Cc: Ivan Kanis, Lars Magne Ingebrigtsen, Lars Grunewaldt
On Sunday 23 June 2013 20:29:55 Lars Magne Ingebrigtsen wrote:
> Ivan Kanis <ivan@kanis.fr> writes:
> > I have attached 3 patches for eww.
>
> Thanks; all applied.
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/113144
I don't think
+ (cond ((eq system-type 'windows-nt)
+ 'browse-url-default-windows-browser)
+ ((eq system-type 'darwin)
+ 'browse-url-default-macosx-browser)
+ (t
+ 'browse-url-netscape))
is a good choice for `eww-external-browser'. Who still uses netscape? And why
duplicate all the effort to find the default browser when this is already done
in browse-url.el?
I think using `browse-url-default-browser' as default value makes more sense.
We could also try to use `browse-url-browser-function', unless it is set to
eww itself:
(if (memq browse-url-browser-function '(eww-browse-url eww))
#'browse-url-default-browser
browse-url-browser-function)
Regards,
Rüdiger
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-23 21:48 ` Rüdiger Sonderfeld
@ 2013-06-23 21:52 ` Lars Magne Ingebrigtsen
[not found] ` <13724493.P5Ma8CTG7m@descartes>
2013-06-24 5:24 ` Ivan Kanis
1 sibling, 1 reply; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-06-23 21:52 UTC (permalink / raw)
To: Rüdiger Sonderfeld; +Cc: Ivan Kanis, Lars Grunewaldt, emacs-devel
Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes:
> I think using `browse-url-default-browser' as default value makes more sense.
I don't seem to have that variable defined in my Emacs.
> We could also try to use `browse-url-browser-function', unless it is set to
> eww itself:
>
> (if (memq browse-url-browser-function '(eww-browse-url eww))
> #'browse-url-default-browser
> browse-url-browser-function)
Perhaps. If `browse-url-browser-function' had some separation between
internal and external browsers, then that would help.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-23 21:48 ` Rüdiger Sonderfeld
2013-06-23 21:52 ` Lars Magne Ingebrigtsen
@ 2013-06-24 5:24 ` Ivan Kanis
2013-06-24 11:14 ` Rüdiger Sonderfeld
1 sibling, 1 reply; 17+ messages in thread
From: Ivan Kanis @ 2013-06-24 5:24 UTC (permalink / raw)
To: Rüdiger Sonderfeld
Cc: Lars Magne Ingebrigtsen, Lars Grunewaldt, emacs-devel
June, 23 at 23:48 Rüdiger Sonderfeld wrote:
> On Sunday 23 June 2013 20:29:55 Lars Magne Ingebrigtsen wrote:
>> Ivan Kanis <ivan@kanis.fr> writes:
>> > I have attached 3 patches for eww.
>>
>> Thanks; all applied.
>
> http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/113144
>
> I don't think ... is a good choice for `eww-external-browser'. Who still
> uses netscape? And why duplicate all the effort to find the default
> browser when this is already done in browse-url.el?
I have my default-browser set to eww. This function calls an external
browser. I have used it for many years. It does what I mean.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-24 5:24 ` Ivan Kanis
@ 2013-06-24 11:14 ` Rüdiger Sonderfeld
2013-06-24 13:03 ` Ivan Kanis
0 siblings, 1 reply; 17+ messages in thread
From: Rüdiger Sonderfeld @ 2013-06-24 11:14 UTC (permalink / raw)
To: emacs-devel; +Cc: Ivan Kanis, Lars Magne Ingebrigtsen, Lars Grunewaldt
On Monday 24 June 2013 07:24:58 Ivan Kanis wrote:
> I have my default-browser set to eww. This function calls an external
> browser. I have used it for many years. It does what I mean.
You mean your `browse-url-browser-function'? That's why my suggestion checks
if it is eww and then uses the `browse-url-default-browser' function in that
case.
If that's not working for a user than she can still customize the `eww-
external-browser' variable. But I think it's a much saner default than trying
to launch Netscape, which nobody uses anymore, isn't even maintained, and is
non-free software.
Regards,
Rüdiger
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-24 11:14 ` Rüdiger Sonderfeld
@ 2013-06-24 13:03 ` Ivan Kanis
2013-06-24 13:18 ` Rüdiger Sonderfeld
0 siblings, 1 reply; 17+ messages in thread
From: Ivan Kanis @ 2013-06-24 13:03 UTC (permalink / raw)
To: Rüdiger Sonderfeld
Cc: Lars Magne Ingebrigtsen, Lars Grunewaldt, emacs-devel
June, 24 at 13:14 Rüdiger Sonderfeld wrote:
> On Monday 24 June 2013 07:24:58 Ivan Kanis wrote:
>> I have my default-browser set to eww. This function calls an external
>> browser. I have used it for many years. It does what I mean.
>
> But I think it's a much saner default than trying to launch Netscape,
> which nobody uses anymore, isn't even maintained, and is non-free
> software.
What makes you think I am launching Netscape? I use Firefox.
--
ゲームでも、仕事でも、秘訣は同じである。
【城山 三郎】
「Pink Floyd - Cluster One」を聴きながら。
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-23 16:58 [PATCH] eww improvements Ivan Kanis
2013-06-23 18:29 ` Lars Magne Ingebrigtsen
@ 2013-06-25 6:07 ` Juri Linkov
2013-06-25 6:29 ` Ivan Kanis
2013-06-25 19:26 ` Lars Magne Ingebrigtsen
1 sibling, 2 replies; 17+ messages in thread
From: Juri Linkov @ 2013-06-25 6:07 UTC (permalink / raw)
To: Ivan Kanis; +Cc: Lars Grunewaldt, Emacs Development List
> @@ -313,6 +319,7 @@
> (define-key map "p" 'eww-previous-url)
> (define-key map "u" 'eww-up-url)
> (define-key map "t" 'eww-top-url)
> + (define-key map "w" 'eww-browse-with-external-browser)
Please bind the keybinding "w" to the command that copies the
current URL from `eww-current-url' to the kill ring because "w"
is used by similar commands `Info-copy-current-node-name' in Info
and `dired-copy-filename-as-kill' in Dired. Note that both
commands have the word "copy" in their names, not "yank".
So to reduce confusion please rename `eww-yank-page-url'
to the name with the word "copy" such as `eww-copy-current-url',
and then bind both `eww-copy-current-url' and `shr-copy-url' to "w".
As for where to bind `eww-browse-with-external-browser'
what do you think about the keybinding "&" (with the mnemonics
of an async command)?
> I have attached my wget.el. I sent the author an e-mail to see if he
> would sign the FSF paper work to include it in Emacs.
wget.el is a very good package, I welcome its inclusion into Emacs.
For the examples of the integration of wget with eww, see the files
w3-wget.el and w3m-wget.el. A similar file could be created
with the name eww-wget.el.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-25 6:07 ` Juri Linkov
@ 2013-06-25 6:29 ` Ivan Kanis
2013-06-25 19:26 ` Lars Magne Ingebrigtsen
1 sibling, 0 replies; 17+ messages in thread
From: Ivan Kanis @ 2013-06-25 6:29 UTC (permalink / raw)
To: Juri Linkov; +Cc: Lars Grunewaldt, Emacs Development List
June, 25 at 9:07 Juri Linkov wrote:
> Please bind the keybinding "w" to the command that copies the
> current URL from `eww-current-url' to the kill ring because "w"
> is used by similar commands `Info-copy-current-node-name' in Info
> and `dired-copy-filename-as-kill' in Dired. Note that both
> commands have the word "copy" in their names, not "yank".
> So to reduce confusion please rename `eww-yank-page-url'
> to the name with the word "copy" such as `eww-copy-current-url',
> and then bind both `eww-copy-current-url' and `shr-copy-url' to "w".
I won't do that. 'y' is doing what it did in emacs-w3m. As to 'w' it's a
mnemonic for web browser which is the key I use. If you want something
else you will have to convince Lars, not me.
> As for where to bind `eww-browse-with-external-browser'
> what do you think about the keybinding "&" (with the mnemonics
> of an async command)?
I am not keen on '&' because it requires to press on the shift key. It's
awkward for me.
>> I have attached my wget.el. I sent the author an e-mail to see if he
>> would sign the FSF paper work to include it in Emacs.
>
> wget.el is a very good package, I welcome its inclusion into Emacs.
The author hasn't replied so it's unlikely it will be included.
--
There is a land of the living and a land of the dead and the bridge is
love, the only survival, the only meaning.
-- Thornton Wilder
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-25 6:07 ` Juri Linkov
2013-06-25 6:29 ` Ivan Kanis
@ 2013-06-25 19:26 ` Lars Magne Ingebrigtsen
2013-06-25 20:15 ` Ivan Kanis
1 sibling, 1 reply; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-06-25 19:26 UTC (permalink / raw)
To: Juri Linkov; +Cc: Ivan Kanis, Lars Grunewaldt, Emacs Development List
Juri Linkov <juri@jurta.org> writes:
> Please bind the keybinding "w" to the command that copies the
> current URL from `eww-current-url' to the kill ring because "w"
> is used by similar commands `Info-copy-current-node-name' in Info
> and `dired-copy-filename-as-kill' in Dired. Note that both
> commands have the word "copy" in their names, not "yank".
> So to reduce confusion please rename `eww-yank-page-url'
> to the name with the word "copy" such as `eww-copy-current-url',
> and then bind both `eww-copy-current-url' and `shr-copy-url' to "w".
>
> As for where to bind `eww-browse-with-external-browser'
> what do you think about the keybinding "&" (with the mnemonics
> of an async command)?
I think all this makes sense, so I've done these changes.
> wget.el is a very good package, I welcome its inclusion into Emacs.
What does wget.el do that's better than what `url-retrieve' does?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-25 19:26 ` Lars Magne Ingebrigtsen
@ 2013-06-25 20:15 ` Ivan Kanis
2013-06-25 20:20 ` Lars Magne Ingebrigtsen
2013-06-25 20:22 ` Ivan Kanis
0 siblings, 2 replies; 17+ messages in thread
From: Ivan Kanis @ 2013-06-25 20:15 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen
Cc: Juri Linkov, Lars Grunewaldt, Emacs Development List
June, 25 at 21:26 Lars Magne Ingebrigtsen wrote:
>> wget.el is a very good package, I welcome its inclusion into Emacs.
>
> What does wget.el do that's better than what `url-retrieve' does?
It has a progression bar and probably does a better for big files.
--
Need to wrap system in aluminum foil to fix problem.
-- BOFH excuse #6
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-25 20:15 ` Ivan Kanis
@ 2013-06-25 20:20 ` Lars Magne Ingebrigtsen
2013-06-25 20:22 ` Ivan Kanis
1 sibling, 0 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-06-25 20:20 UTC (permalink / raw)
To: Ivan Kanis; +Cc: Juri Linkov, Lars Grunewaldt, Emacs Development List
Ivan Kanis <ivan@kanis.fr> writes:
> It has a progression bar and probably does a better for big files.
Adding a progress bar of some kind to `url-retrieve' has been discussed,
and I most people agreed that it was a good idea. A progress bar or a
spinner or something. But nobody implemented it.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] eww improvements
2013-06-25 20:15 ` Ivan Kanis
2013-06-25 20:20 ` Lars Magne Ingebrigtsen
@ 2013-06-25 20:22 ` Ivan Kanis
1 sibling, 0 replies; 17+ messages in thread
From: Ivan Kanis @ 2013-06-25 20:22 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen
Cc: Juri Linkov, Lars Grunewaldt, Emacs Development List
June, 25 at 22:15 Ivan wrote:
> June, 25 at 21:26 Lars Magne Ingebrigtsen wrote:
>
>>> wget.el is a very good package, I welcome its inclusion into Emacs.
>>
>> What does wget.el do that's better than what `url-retrieve' does?
>
> It has a progression bar and probably does a better for big files.
I meant a "better job"
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2013-06-25 20:22 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-23 16:58 [PATCH] eww improvements Ivan Kanis
2013-06-23 18:29 ` Lars Magne Ingebrigtsen
2013-06-23 21:48 ` Rüdiger Sonderfeld
2013-06-23 21:52 ` Lars Magne Ingebrigtsen
[not found] ` <13724493.P5Ma8CTG7m@descartes>
2013-06-24 13:58 ` Lars Magne Ingebrigtsen
2013-06-24 5:24 ` Ivan Kanis
2013-06-24 11:14 ` Rüdiger Sonderfeld
2013-06-24 13:03 ` Ivan Kanis
2013-06-24 13:18 ` Rüdiger Sonderfeld
2013-06-24 17:01 ` Ivan Kanis
2013-06-24 17:40 ` Lars Magne Ingebrigtsen
2013-06-25 6:07 ` Juri Linkov
2013-06-25 6:29 ` Ivan Kanis
2013-06-25 19:26 ` Lars Magne Ingebrigtsen
2013-06-25 20:15 ` Ivan Kanis
2013-06-25 20:20 ` Lars Magne Ingebrigtsen
2013-06-25 20:22 ` Ivan Kanis
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.