Subject: bug#27341: eww-search-words should prompt if region inactive

From: Alex Branham <[email-masked]>
Date: Mon, 12 Jun 2017 13:21:15 +0200

eww-search-words (M-S M-w) searches for the active region and doesn't do anything useful if the region isn't active. This patch has it prompt the user for a search string if the region isn't active.

Alex
>From bf8cda29c442fa773ce59fe7bf7760887399c8fd Mon Sep 17 00:00:00 2001
From: Alex Branham <[email-masked]>
Date: Mon, 12 Jun 2017 13:10:27 +0200
Subject: [PATCH] eww-earch-prefix: prompt for query if region inactive

---
 lisp/net/eww.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index fe31657914..dd64dc81eb 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -316,7 +316,9 @@ word(s) will be searched for via `eww-search-prefix'."
   "Search the web for the text between BEG and END.
 See the `eww-search-prefix' variable for the search engine used."
   (interactive "r")
-  (eww (buffer-substring beg end)))
+  (if (region-active-p)
+      (eww (buffer-substring beg end))
+    (eww (read-string "Query: "))))
 
 (defun eww-open-in-new-buffer ()
   "Fetch link at point in a new EWW buffer."
-- 
2.13.1