* bug#15911: 24.3.50; [PATCH] eww: can not handle hostname "localhost"
@ 2013-11-16 12:56 Kenjiro NAKAYAMA
2013-11-21 16:43 ` Ted Zlatanov
0 siblings, 1 reply; 3+ messages in thread
From: Kenjiro NAKAYAMA @ 2013-11-16 12:56 UTC (permalink / raw
To: 15911
With M-x eww RET and "localhost" RET, eww searches "localhost" via ddg ("https://duckduckgo.com/html/?q=localhost"), so it does not handle "localhost" as "http://localhost/".
This patch is not only to solve it but also becoming possible to open the non-extension files by eww-open-file.
(Current eww-open-file can browse "exampleFile.html" but can't browse non-extension files like "exampleFile".)
I know I should send sepalately, but the former problem should modify with the latter one at the same time since it is using same logic.
Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
---
lisp/net/eww.el | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 573715e..6accf60 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -107,17 +107,20 @@
If the input doesn't look like an URL or a domain name, the
word(s) will be searched for via `eww-search-prefix'."
(interactive "sEnter URL or keywords: ")
- (if (and (= (length (split-string url)) 1)
- (> (length (split-string url "\\.")) 1))
- (progn
- (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
- (setq url (concat "http://" url)))
- ;; some site don't redirect final /
- (when (string= (url-filename (url-generic-parse-url url)) "")
- (setq url (concat url "/"))))
- (unless (string-match-p "\\'file:" url)
- (setq url (concat eww-search-prefix
- (replace-regexp-in-string " " "+" url)))))
+ (cond ((string-match-p "\\`file:" url))
+ (t
+ (if (and (= (length (split-string url)) 1)
+ (or (> (length (split-string url "\\.")) 1)
+ (string-match "localhost" url)))
+ (progn
+ (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
+ (setq url (concat "http://" url)))
+ ;; some site don't redirect final /
+ (when (string= (url-filename (url-generic-parse-url url)) "")
+ (setq url (concat url "/"))))
+ (setq url (concat eww-search-prefix
+ (replace-regexp-in-string " " "+" url))))
+ ))
(url-retrieve url 'eww-render (list url)))
;;;###autoload
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#15911: 24.3.50; [PATCH] eww: can not handle hostname "localhost"
2013-11-16 12:56 bug#15911: 24.3.50; [PATCH] eww: can not handle hostname "localhost" Kenjiro NAKAYAMA
@ 2013-11-21 16:43 ` Ted Zlatanov
2013-11-21 18:52 ` Ted Zlatanov
0 siblings, 1 reply; 3+ messages in thread
From: Ted Zlatanov @ 2013-11-21 16:43 UTC (permalink / raw
To: Kenjiro NAKAYAMA; +Cc: 15911
On Sat, 16 Nov 2013 21:56:52 +0900 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> wrote:
KN> With M-x eww RET and "localhost" RET, eww searches "localhost" via
KN> ddg ("https://duckduckgo.com/html/?q=localhost"), so it does not
KN> handle "localhost" as "http://localhost/". This patch is not only
KN> to solve it but also becoming possible to open the non-extension
KN> files by eww-open-file. (Current eww-open-file can browse
KN> "exampleFile.html" but can't browse non-extension files like
KN> "exampleFile".) I know I should send sepalately, but the former
KN> problem should modify with the latter one at the same time since it
KN> is using same logic.
KN> Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
Installed as "tiny change" with a small modification.
Thanks
Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#15911: 24.3.50; [PATCH] eww: can not handle hostname "localhost"
2013-11-21 16:43 ` Ted Zlatanov
@ 2013-11-21 18:52 ` Ted Zlatanov
0 siblings, 0 replies; 3+ messages in thread
From: Ted Zlatanov @ 2013-11-21 18:52 UTC (permalink / raw
To: Kenjiro NAKAYAMA; +Cc: 15911-done
Marking as done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-21 18:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-16 12:56 bug#15911: 24.3.50; [PATCH] eww: can not handle hostname "localhost" Kenjiro NAKAYAMA
2013-11-21 16:43 ` Ted Zlatanov
2013-11-21 18:52 ` Ted Zlatanov
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.