emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master df6cc4d33b6 1/3: eww: Enable completion in URL/keyword prompt.


From: Eli Zaretskii
Subject: master df6cc4d33b6 1/3: eww: Enable completion in URL/keyword prompt.
Date: Tue, 25 Apr 2023 10:30:57 -0400 (EDT)

branch: master
commit df6cc4d33b63880a270297ac321a0ae338274cd7
Author: Antero Mejr <antero@mailbox.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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 4c5f50e343e..38858a4bc63 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -231,6 +231,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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]