From: Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
To: 15911@debbugs.gnu.org
Subject: bug#15911: 24.3.50; [PATCH] eww: can not handle hostname "localhost"
Date: Sat, 16 Nov 2013 21:56:52 +0900 [thread overview]
Message-ID: <87ob5k33or.fsf@dhcp-193-97.nrt.redhat.com> (raw)
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
next reply other threads:[~2013-11-16 12:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-16 12:56 Kenjiro NAKAYAMA [this message]
2013-11-21 16:43 ` bug#15911: 24.3.50; [PATCH] eww: can not handle hostname "localhost" Ted Zlatanov
2013-11-21 18:52 ` Ted Zlatanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ob5k33or.fsf@dhcp-193-97.nrt.redhat.com \
--to=nakayamakenjiro@gmail.com \
--cc=15911@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).