Subject: [PATCH] Implement separate eww history

From: Robert Pluim <[email-masked]>
Date: Wed, 20 Dec 2017 12:56:53 +0100

It's always bugged me that eww uses the minibuffer history when
reading which url to open. Attached a patch to enable an optional
separate history.

I'm assuming this would target 27.1

Regards

Robert

>From e805d28d8ef16db59347f44faf39fde5fd329fc6 Mon Sep 17 00:00:00 2001
From: Robert Pluim <[email-masked]>
Date: Wed, 25 Oct 2017 15:20:34 +0200
Subject: [PATCH] Add support for eww url history

* doc/misc/eww.texi (Basics): Document eww-separate-history

* etc/NEWS : Add documentation for eww-separate-history

* lisp/net/eww.el (eww-separate-history): Define.
(eww): Use it.
---
 doc/misc/eww.texi |  6 ++++++
 etc/NEWS          |  4 ++++
 lisp/net/eww.el   | 12 +++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index e9b544fbde..7fc6b068d9 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -85,6 +85,12 @@ Basics
 either prefix the file name with @code{file://} or use the command
 @kbd{M-x eww-open-file}.
 
+@vindex eww-separate-history
+@cindex eww
+  If you want to keep the history of URI's you've opened separate from
+the default minibuffer history, set @code{eww-separate-history} to
+@code{t}
+
 @findex eww-quit
 @findex eww-reload
 @findex eww-copy-page-url
diff --git a/etc/NEWS b/etc/NEWS
index 784c608041..df1520566a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -900,6 +900,10 @@ bigger than the current window).
 avoid accidentally accessing remote links may rebind 'w' and 'u' in
 'eww-link-keymap' to it.
 
++++
+*** The new user variable 'eww-separate-history' causes eww to use a
+separate minibuffer history if non-nil
+
 ** Ido
 
 ---
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index bff592c3fe..b480710b98 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -113,6 +113,15 @@ eww-restore-reload-prompt
   :group 'eww
   :type 'string)
 
+(defcustom eww-separate-history nil
+  "If t, keep the URI history separate from the minibuffer history.
+If nil, use the default minibuffer history list when prompting
+for a URI.  Note that this history is only used when prompting,
+it is separate from those used by `eww-list-histories'."
+  :version "27.1"
+  :group 'eww
+  :type 'boolean)
+
 (defcustom eww-history-limit 50
   "Maximum number of entries to retain in the history."
   :version "25.1"
@@ -218,6 +227,7 @@ eww-valid-certificate
 (defvar eww-data nil)
 (defvar eww-history nil)
 (defvar eww-history-position 0)
+(defvar eww-uri-history nil)
 
 (defvar eww-local-regex "localhost"
   "When this regex is found in the URL, it's not a keyword but an address.")
@@ -250,7 +260,7 @@ eww
 	  (prompt (concat "Enter URL or keywords"
 			  (if uris (format " (default %s)" (car uris)) "")
 			  ": ")))
-     (list (read-string prompt nil nil uris))))
+     (list (read-string prompt nil (and eww-separate-history 'eww-uri-history) uris))))
   (setq url (eww--dwim-expand-url url))
   (pop-to-buffer-same-window
    (if (eq major-mode 'eww-mode)
-- 
2.15.0.276.g89ea799ff