[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113143: eww.el: If given a non-domain text, search
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] trunk r113143: eww.el: If given a non-domain text, search for the term |
Date: |
Sun, 23 Jun 2013 18:22:32 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113143
revision-id: address@hidden
parent: address@hidden
author: Ivan Kanis <address@hidden>
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Sun 2013-06-23 20:22:28 +0200
message:
eww.el: If given a non-domain text, search for the term
* net/eww.el (eww-search-prefix): New variable.
(eww): Use it.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/net/eww.el eww.el-20130610114603-80ap3gwnw4x4m5ix-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-06-23 13:23:49 +0000
+++ b/lisp/ChangeLog 2013-06-23 18:22:28 +0000
@@ -1,3 +1,8 @@
+2013-06-23 Ivan Kanis <address@hidden>
+
+ * net/eww.el (eww-search-prefix): New variable.
+ (eww): Use it.
+
2013-06-23 Juanma Barranquero <address@hidden>
* emacs-lisp/tabulated-list.el (tabulated-list-init-header):
=== modified file 'lisp/net/eww.el'
--- a/lisp/net/eww.el 2013-06-21 07:52:47 +0000
+++ b/lisp/net/eww.el 2013-06-23 18:22:28 +0000
@@ -40,6 +40,13 @@
"Header line format.
- %t is replaced by the title.
- %u is replaced by the URL."
+ :version "24.4"
+ :group 'eww
+ :type 'string)
+
+(defcustom eww-search-prefix "https://duckduckgo.com/html/?q="
+ "Prefix URL to search engine"
+ :version "24.4"
:group 'eww
:type 'string)
@@ -89,10 +96,16 @@
;;;###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)))
+ "Fetch URL and render the page.
+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))
+ (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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113143: eww.el: If given a non-domain text, search for the term,
Lars Ingebrigtsen <=