From 1779ea789e6478a48a2503eda735ab34edce79e4 Mon Sep 17 00:00:00 2001 From: Antero Mejr Date: Wed, 12 Apr 2023 17:56:01 +0000 Subject: [PATCH v4 1/3] eww: Enable completion in URL/keyword prompt. * lisp/net/eww.el (eww): Use 'completing-read' when prompting for a URL or keywords. (eww-minibuffer-url-keymap): New keymap for use in the URL/keyword prompt. * etc/NEWS (EWW): Add NEWS entry for the change. (Bug#62800) --- etc/NEWS | 5 +++++ lisp/net/eww.el | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index ca529be7aa1..df749a12743 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -226,6 +226,11 @@ the new argument NEW-BUFFER non-nil, it will use a new buffer instead. Interactively, invoke 'eww-open-file' with a prefix argument to activate this behavior. ++++ +*** 'eww' URL or keyword prompt now has tab completion. +The interactive minibuffer prompt when invoking 'eww' now has support +for tab completion. + ** go-ts-mode +++ diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 99450356b7c..eb123864973 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -329,6 +329,12 @@ parameter, and should return the (possibly) transformed URL." :parent shr-image-map "RET" #'eww-follow-link) +(defvar-keymap eww-minibuffer-url-keymap + :doc "Keymap used in the minibuffer prompt for URLs or keywords." + :parent minibuffer-local-completion-map + "SPC" #'self-insert-command + "?" #'self-insert-command) + (defun eww-suggested-uris nil "Return the list of URIs to suggest at the `eww' prompt. This list can be customized via `eww-suggest-uris'." @@ -377,10 +383,12 @@ killed after rendering. For more information, see Info node `(eww) Top'." (interactive - (let ((uris (eww-suggested-uris))) - (list (read-string (format-prompt "Enter URL or keywords" - (and uris (car uris))) - nil 'eww-prompt-history uris) + (let ((uris (eww-suggested-uris)) + (minibuffer-local-completion-map eww-minibuffer-url-keymap)) + (list (completing-read (format-prompt "Enter URL or keywords" + (and uris (car uris))) + eww-prompt-history nil nil nil + 'eww-prompt-history uris) current-prefix-arg))) (setq url (eww--dwim-expand-url url)) (pop-to-buffer-same-window -- 2.39.2