From 62a6e28e0cc2f7f652f2944a78c88a07051dbeae Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Wed, 2 Nov 2016 16:18:49 -0400 Subject: [PATCH] Revert change to eww-suggest-uris The introduced append is ugly and can yield '(nil); doing delq on it would be hacks on hacks. * lisp/net/eww.el: Require cl-lib at run time. (eww-suggest-uris): Restore eww-current-url, reverting previous change. (eww): Remove erroneous append. (eww-open-in-new-buffer): Check if the return from eww-suggested-uris is equal to eww-current-url, which is nil anyways if we are not in an EWW buffer. --- lisp/net/eww.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 5310a814655..a5b3ce3927e 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -24,7 +24,7 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(require 'cl-lib) (require 'format-spec) (require 'shr) (require 'url) @@ -64,16 +64,18 @@ ;;;###autoload (defcustom eww-suggest-uris '(eww-links-at-point - url-get-url-at-point) + url-get-url-at-point + eww-current-url) "List of functions called to form the list of default URIs for `eww'. Each of the elements is a function returning either a string or a list of strings. The results will be joined into a single list with duplicate entries (if any) removed." - :version "26.1" + :version "25.1" :group 'eww :type 'hook :options '(eww-links-at-point - url-get-url-at-point)) + url-get-url-at-point + eww-current-url)) (defcustom eww-bookmarks-directory user-emacs-directory "Directory where bookmark files will be stored." @@ -244,7 +246,7 @@ This list can be customized via `eww-suggest-uris'." 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 - (let* ((uris (append (eww-suggested-uris) (list (eww-current-url)))) + (let* ((uris (eww-suggested-uris)) (prompt (concat "Enter URL or keywords" (if uris (format " (default %s)" (car uris)) "") ": "))) @@ -322,7 +324,9 @@ See the `eww-search-prefix' variable for the search engine used." (with-current-buffer (if (eq major-mode 'eww-mode) (clone-buffer) (generate-new-buffer "*eww*")) - (eww (if (consp url) (car url) url)))))) + (unless (equal url (eww-current-url)) + (eww-mode) + (eww (if (consp url) (car url) url))))))) (defun eww-html-p (content-type) "Return non-nil if CONTENT-TYPE designates an HTML content type. -- 2.39.5