unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
@ 2023-04-12 18:10 Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-12 18:32 ` Juri Linkov
  0 siblings, 1 reply; 13+ messages in thread
From: Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-04-12 18:10 UTC (permalink / raw)
  To: 62800

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]


The attached patch adds completion support to the EWW URL prompt (M-x eww).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-eww-Use-completion-in-URL-keyword-prompt.patch --]
[-- Type: text/x-patch, Size: 1753 bytes --]

From 03f566d9e605ecd1008f53572420f52063fc4522 Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
Date: Wed, 12 Apr 2023 17:56:01 +0000
Subject: [PATCH] eww: Use completion in URL/keyword prompt.

* lisp/net/eww.el (eww): Use 'completing-read' when prompting for a URL
or keywords.
* etc/NEWS (EWW): Add NEWS entry for the change.
---
 etc/NEWS        | 5 +++++
 lisp/net/eww.el | 7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5e1fd76e99e..9f9317d5ea9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -219,6 +219,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' now has completion when prompting for a URL or keywords.
+The interactive minibuffer prompt when invoking 'eww' now has support
+for completion.
+
 ** go-ts-mode
 
 +++
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 11be20b68db..4e4445b76fa 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -378,9 +378,10 @@ 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)
+     (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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-12 18:10 bug#62800: [PATCH] eww: Use completion in URL/keyword prompt Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-04-12 18:32 ` Juri Linkov
  2023-04-12 19:44   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2023-04-12 18:32 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 62800

> The attached patch adds completion support to the EWW URL prompt (M-x eww).
>    (interactive
>     (let ((uris (eww-suggested-uris)))
> -     (list (read-string (format-prompt "Enter URL or keywords"
> -                                       (and uris (car uris)))
> -                        nil 'eww-prompt-history uris)
> +     (list (completing-read (format-prompt "Enter URL or keywords"
> +                                           (and uris (car uris)))
> +                            eww-prompt-history nil nil nil
> +                            'eww-prompt-history uris)

Emacs 29 has a new command 'minibuffer-complete-history'
that completes on the history.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-12 18:32 ` Juri Linkov
@ 2023-04-12 19:44   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-12 21:43     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-13  6:40     ` Juri Linkov
  0 siblings, 2 replies; 13+ messages in thread
From: Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-04-12 19:44 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 62800

Juri Linkov <juri@linkov.net> writes:

> Emacs 29 has a new command 'minibuffer-complete-history'
> that completes on the history.

I don't understand. The patch adds the ability to use
minibuffer-complete-history by pressing the TAB key while typing a
URL. The behavior I'm seeing now (in version 29.0.50), is when I type in
a URL and press tab, instead of completing, it inserts a tab
character.

The intention isn't to finish the completion automatically. Suppose a
user has "example.com/a" in their completion history. If the user types
out "example.com" and we call (minibuffer-complete-history) for them, it
will expand to "example.com/a" which is not the URL they want.

I may have misworded the commit message or be misunderstanding what you
are suggesting.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-12 19:44   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-04-12 21:43     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-13  1:31       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-13  6:40     ` Juri Linkov
  1 sibling, 1 reply; 13+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-04-12 21:43 UTC (permalink / raw)
  To: 62800; +Cc: antero, juri

Hi,

> -     (list (read-string (format-prompt "Enter URL or keywords"
> -                                       (and uris (car uris)))
> -                        nil 'eww-prompt-history uris)
> +     (list (completing-read (format-prompt "Enter URL or keywords"
> +                                           (and uris (car uris)))
> +                            eww-prompt-history nil nil nil
> +                            'eww-prompt-history uris)

Note that this change doesn't work so well for the use case of inserting
space-separated keywords, since it causes SPC to be bound to
`minibuffer-complete-word' instead of `self-insert-command'. That means
that with this patch, typing M-x eww f o o SPC shows "No match" instead
of inserting a space character after "foo".  So if one wants to search
for "foo bar" they now need to type M-SPC or C-q SPC to separate search
words.

I definitely agree that it'd be useful to have proper completion in
eww's prompt though, ideally without the annoying side effect of
changing the behavior of SPC.

(Personally, I have a custom version of the eww command that does pretty
much the same thing as this patch does, but I'm already used to typing
M-SPC instead of SPC every once in a while.  Also, I still have the
regular M-x eww (and M-s M-w) available if that gets inconvenient.)

Cheers,
Eshel





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-12 21:43     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-04-13  1:31       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-13  6:41         ` Juri Linkov
  0 siblings, 1 reply; 13+ messages in thread
From: Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-04-13  1:31 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: 62800, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]

Eshel Yaron <me@eshelyaron.com> writes:

>> -     (list (read-string (format-prompt "Enter URL or keywords"
>> -                                       (and uris (car uris)))
>> -                        nil 'eww-prompt-history uris)
>> +     (list (completing-read (format-prompt "Enter URL or keywords"
>> +                                           (and uris (car uris)))
>> +                            eww-prompt-history nil nil nil
>> +                            'eww-prompt-history uris)
>
> Note that this change doesn't work so well for the use case of inserting
> space-separated keywords, since it causes SPC to be bound to
> `minibuffer-complete-word' instead of `self-insert-command'.

Good point. The attached v2 patch creates a new keymap called
"eww-minibuffer-url-keymap" with "SPC" and "?" bound to
self-insert-command, and uses that map for the URL/keyword prompt.

Rebinding minibuffer-local-completion-map is done in a few places in the
code. It is also suggested in the manual (49.3.4 Minibuffer Keymaps),
and was already in my init file, which is why I didn't notice the
problem.

It would be nice if there was a single keymap along the lines of
"minibuffer-local-text-completion-map" that can be used for all those
existing cases, and for completion in commands like "M-x rgrep".  But
that is a bigger change and beyond the scope of this patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-eww-Enable-completion-in-URL-keyword-prompt.patch --]
[-- Type: text/x-patch, Size: 2452 bytes --]

From 4be47c886d2e1aeeeaa40a53dea5a8f5f209b652 Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
Date: Wed, 12 Apr 2023 17:56:01 +0000
Subject: [PATCH v2] 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.
---
 etc/NEWS        |  5 +++++
 lisp/net/eww.el | 16 ++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5e1fd76e99e..9f9317d5ea9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -219,6 +219,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' now has completion when prompting for a URL or keywords.
+The interactive minibuffer prompt when invoking 'eww' now has support
+for completion.
+
 ** go-ts-mode
 
 +++
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 11be20b68db..7f0c9167c6a 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-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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-12 19:44   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-12 21:43     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-04-13  6:40     ` Juri Linkov
  2023-04-13 17:16       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2023-04-13  6:40 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 62800

>> Emacs 29 has a new command 'minibuffer-complete-history'
>> that completes on the history.
>
> I don't understand. The patch adds the ability to use
> minibuffer-complete-history by pressing the TAB key while typing a
> URL. The behavior I'm seeing now (in version 29.0.50), is when I type in
> a URL and press tab, instead of completing, it inserts a tab
> character.

I just noted that this is already possible by typing less convenient key
'C-x up'.  But if you think 'TAB' could do the same, this is fine.
Maybe even eww-suggested-uris could be added to the list of history
completions as well.  Because browsers show completions not only for
previously visited urls from the history, but also for suggested urls.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-13  1:31       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-04-13  6:41         ` Juri Linkov
  0 siblings, 0 replies; 13+ messages in thread
From: Juri Linkov @ 2023-04-13  6:41 UTC (permalink / raw)
  To: Antero Mejr; +Cc: Eshel Yaron, 62800

> It would be nice if there was a single keymap along the lines of
> "minibuffer-local-text-completion-map" that can be used for all those
> existing cases, and for completion in commands like "M-x rgrep".  But
> that is a bigger change and beyond the scope of this patch.

If you want to complete history in all non-completion minibuffers
like 'rgrep', this is easy to achieve with just:

(keymap-set minibuffer-local-map "TAB" 'minibuffer-complete-history)





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-13  6:40     ` Juri Linkov
@ 2023-04-13 17:16       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-22  9:03         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-04-13 17:16 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 62800

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

Juri Linkov <juri@linkov.net> writes:

>>> Emacs 29 has a new command 'minibuffer-complete-history'
>>> that completes on the history.
>>
>> I don't understand. The patch adds the ability to use
>> minibuffer-complete-history by pressing the TAB key while typing a
>> URL. The behavior I'm seeing now (in version 29.0.50), is when I type in
>> a URL and press tab, instead of completing, it inserts a tab
>> character.
>
> I just noted that this is already possible by typing less convenient key
> 'C-x up'.  But if you think 'TAB' could do the same, this is fine.
> Maybe even eww-suggested-uris could be added to the list of history
> completions as well.  Because browsers show completions not only for
> previously visited urls from the history, but also for suggested urls.

New patches are attached. The first adds tab completion and is just
slightly reworded. The second adds "eww-suggested-uris" to the
completion options, and adds bookmark URIs to the "eww-suggest-uris"
list, since browsers suggest bookmarks too.

If there is "http://example.com" in the bookmarks, and "example.com" in
the history, both will be provided as a completion. I think this
behavior is correct because those two URLs may not point to the same
place, but browsers sometimes remove the URL scheme component and assume
http:// or https://. I don't think matching that behavior would be good
so I didn't implement it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v3-0001-eww-Enable-completion-in-URL-keyword-prompt.patch --]
[-- Type: text/x-patch, Size: 2449 bytes --]

From c2e4f72f21af20afdc2fc2f5ebe6bffcb61c2f5d Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
Date: Wed, 12 Apr 2023 17:56:01 +0000
Subject: [PATCH v3 1/2] 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.
---
 etc/NEWS        |  5 +++++
 lisp/net/eww.el | 16 ++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5e1fd76e99e..2df0d969991 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -219,6 +219,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 11be20b68db..7f0c9167c6a 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-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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: v3-0002-eww-Provide-completions-for-bookmarks-and-suggest.patch --]
[-- Type: text/x-patch, Size: 3128 bytes --]

From 1c635c024a9b7e01c29704af0939c7a39583ee9c Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
Date: Thu, 13 Apr 2023 15:59:54 +0000
Subject: [PATCH v3 2/2] eww: Provide completions for bookmarks and suggested
 URIs.

* lisp/net/eww.el (eww): Add the result of 'eww-suggest-uris' to the
completion collection argument.
(eww-bookmark-urls): New procedure.
(eww-suggest-uris): Add "eww-bookmark-urls" to the default list.
* etc/NEWS (EWW): Add NEWS entry for the change.
---
 etc/NEWS        |  6 ++++++
 lisp/net/eww.el | 16 ++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 2df0d969991..41880208c7e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -224,6 +224,12 @@ activate this behavior.
 The interactive minibuffer prompt when invoking 'eww' now has support
 for tab completion.
 
++++
+*** 'eww' URL and keyword prompt now completes suggested URIs and bookmarks.
+The interactive minibuffer prompt when invoking 'eww' now provides
+completions from 'eww-suggest-uris'. 'eww-suggest-uris' now includes
+bookmark URIs.
+
 ** go-ts-mode
 
 +++
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 7f0c9167c6a..48a1813c92d 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -94,7 +94,8 @@ no parameters) that returns a directory name."
 (defcustom eww-suggest-uris
   '(eww-links-at-point
     thing-at-point-url-at-point
-    eww-current-url)
+    eww-current-url
+    eww-bookmark-urls)
   "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
@@ -104,7 +105,8 @@ duplicate entries (if any) removed."
   :type 'hook
   :options '(eww-links-at-point
              thing-at-point-url-at-point
-             eww-current-url))
+             eww-current-url
+             eww-bookmark-urls))
 
 (defcustom eww-bookmarks-directory user-emacs-directory
   "Directory where bookmark files will be stored."
@@ -387,8 +389,8 @@ For more information, see Info node `(eww) Top'."
          (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)
+                            (seq-uniq (append eww-prompt-history uris))
+                            nil nil nil 'eww-prompt-history uris)
            current-prefix-arg)))
   (setq url (eww--dwim-expand-url url))
   (pop-to-buffer-same-window
@@ -2235,6 +2237,12 @@ If ERROR-OUT, signal user-error if there are no bookmarks."
 					'eww-bookmark)))
     (eww-browse-url (plist-get bookmark :url))))
 
+(defun eww-bookmark-urls ()
+  "Get the URLs from the current list of bookmarks."
+  (interactive nil eww-boomark-mode)
+  (eww-read-bookmarks)
+  (mapcar (lambda (x) (plist-get x :url)) eww-bookmarks))
+
 (defvar-keymap eww-bookmark-mode-map
   "C-k" #'eww-bookmark-kill
   "C-y" #'eww-bookmark-yank
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-13 17:16       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-04-22  9:03         ` Eli Zaretskii
  2023-04-23 18:03           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-22  9:03 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 62800, juri

> Cc: 62800@debbugs.gnu.org
> Date: Thu, 13 Apr 2023 17:16:53 +0000
> From:  Antero Mejr via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> New patches are attached. The first adds tab completion and is just
> slightly reworded. The second adds "eww-suggested-uris" to the
> completion options, and adds bookmark URIs to the "eww-suggest-uris"
> list, since browsers suggest bookmarks too.

Thanks.  The patches don't apply to the Emacs master branch.  Could
you please update them and re-post?  When you do so, please mention
the bug number in the commit log messages, to minimize the amount of
manual work required when installing the changes.

Also, this and your previous contributions exhaust the amount of
changes we can accept without a copyright assignment.  Would you like
to start the legal paperwork of assigning the copyright at this time,
so we could accept contributions from you in the future without
limitations?

Thanks.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-22  9:03         ` Eli Zaretskii
@ 2023-04-23 18:03           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-23 18:31             ` Eli Zaretskii
                               ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-04-23 18:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62800

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 62800@debbugs.gnu.org
>> Date: Thu, 13 Apr 2023 17:16:53 +0000
>> From:  Antero Mejr via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> New patches are attached. The first adds tab completion and is just
>> slightly reworded. The second adds "eww-suggested-uris" to the
>> completion options, and adds bookmark URIs to the "eww-suggest-uris"
>> list, since browsers suggest bookmarks too.
>
> Thanks.  The patches don't apply to the Emacs master branch.  Could
> you please update them and re-post?  When you do so, please mention
> the bug number in the commit log messages, to minimize the amount of
> manual work required when installing the changes.

Updated patches are attached.

> Also, this and your previous contributions exhaust the amount of
> changes we can accept without a copyright assignment.  Would you like
> to start the legal paperwork of assigning the copyright at this time,
> so we could accept contributions from you in the future without
> limitations?

I submitted all the paperwork in early March for my other pending patch,
but haven't gotten the counter-signed copy yet. Hopefully it's in the
queue somewhere. I wrote another patch mentioning the assignment time
frame in the CONTRIBUTING file, since new contributors might assume
something is wrong if they haven't heard back, but based on what I've
read 6+ weeks is normal.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v4-0001-eww-Enable-completion-in-URL-keyword-prompt.patch --]
[-- Type: text/x-patch, Size: 2468 bytes --]

From 1779ea789e6478a48a2503eda735ab34edce79e4 Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: v4-0002-eww-Provide-completions-for-bookmarks-and-suggest.patch --]
[-- Type: text/x-patch, Size: 3141 bytes --]

From 4832f508748e8c3e6c94e8e5c4bf7ddc057b5265 Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
Date: Thu, 13 Apr 2023 15:59:54 +0000
Subject: [PATCH v4 2/3] eww: Provide completions for bookmarks and suggested
 URIs.

* lisp/net/eww.el (eww): Add the result of 'eww-suggest-uris' to the
completion collection argument.
(eww-bookmark-urls): New procedure.
(eww-suggest-uris): Add "eww-bookmark-urls" to the default list.
* etc/NEWS (EWW): Add NEWS entry for the change.  (Bug#62800)
---
 etc/NEWS        |  6 ++++++
 lisp/net/eww.el | 16 ++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index df749a12743..286cfcad4f3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -231,6 +231,12 @@ activate this behavior.
 The interactive minibuffer prompt when invoking 'eww' now has support
 for tab completion.
 
++++
+*** 'eww' URL and keyword prompt now completes suggested URIs and bookmarks.
+The interactive minibuffer prompt when invoking 'eww' now provides
+completions from 'eww-suggest-uris'. 'eww-suggest-uris' now includes
+bookmark URIs.
+
 ** go-ts-mode
 
 +++
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index eb123864973..61f0f47373d 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -94,7 +94,8 @@ no parameters) that returns a directory name."
 (defcustom eww-suggest-uris
   '(eww-links-at-point
     thing-at-point-url-at-point
-    eww-current-url)
+    eww-current-url
+    eww-bookmark-urls)
   "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
@@ -104,7 +105,8 @@ duplicate entries (if any) removed."
   :type 'hook
   :options '(eww-links-at-point
              thing-at-point-url-at-point
-             eww-current-url))
+             eww-current-url
+             eww-bookmark-urls))
 
 (defcustom eww-bookmarks-directory user-emacs-directory
   "Directory where bookmark files will be stored."
@@ -387,8 +389,8 @@ For more information, see Info node `(eww) Top'."
          (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)
+                            (seq-uniq (append eww-prompt-history uris))
+                            nil nil nil 'eww-prompt-history uris)
            current-prefix-arg)))
   (setq url (eww--dwim-expand-url url))
   (pop-to-buffer-same-window
@@ -2235,6 +2237,12 @@ If ERROR-OUT, signal user-error if there are no bookmarks."
 					'eww-bookmark)))
     (eww-browse-url (plist-get bookmark :url))))
 
+(defun eww-bookmark-urls ()
+  "Get the URLs from the current list of bookmarks."
+  (interactive nil eww-boomark-mode)
+  (eww-read-bookmarks)
+  (mapcar (lambda (x) (plist-get x :url)) eww-bookmarks))
+
 (defvar-keymap eww-bookmark-mode-map
   "C-k" #'eww-bookmark-kill
   "C-y" #'eww-bookmark-yank
-- 
2.39.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-Mention-copyright-assignment-time-frame.patch --]
[-- Type: text/x-patch, Size: 1026 bytes --]

From ef1abee64d9826ce0c29413738c171bc012c2942 Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
Date: Sun, 23 Apr 2023 17:40:39 +0000
Subject: [PATCH] Mention copyright assignment time frame.

* CONTRIBUTE (Getting involved with development): Mention copyright
assignment time frame and add a reminder to make sure patches apply.
---
 CONTRIBUTE | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CONTRIBUTE b/CONTRIBUTE
index 464b800adfb..85fc485646f 100644
--- a/CONTRIBUTE
+++ b/CONTRIBUTE
@@ -81,6 +81,9 @@ and return the completed information to the address at the top.
 (There are other assignment options, but they are much less commonly used.)
 If you have questions about the assignment process, you can ask the
 address listed on the form, and/or emacs-devel@gnu.org.
+The assignment process may take 6-8 weeks, so please ensure your
+pending patches still apply on the relevant branch, if the branch
+moves forward during that time period.
 
 ** Issue tracker (a.k.a. "bug tracker")
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-23 18:03           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-04-23 18:31             ` Eli Zaretskii
  2023-04-24 11:56             ` Eli Zaretskii
  2023-04-25 14:33             ` Eli Zaretskii
  2 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-23 18:31 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 62800

> From: Antero Mejr <antero@mailbox.org>
> Cc: 62800@debbugs.gnu.org
> Date: Sun, 23 Apr 2023 18:03:34 +0000
> 
> > Thanks.  The patches don't apply to the Emacs master branch.  Could
> > you please update them and re-post?  When you do so, please mention
> > the bug number in the commit log messages, to minimize the amount of
> > manual work required when installing the changes.
> 
> Updated patches are attached.

Thanks, will review soon.

> > Also, this and your previous contributions exhaust the amount of
> > changes we can accept without a copyright assignment.  Would you like
> > to start the legal paperwork of assigning the copyright at this time,
> > so we could accept contributions from you in the future without
> > limitations?
> 
> I submitted all the paperwork in early March for my other pending patch,
> but haven't gotten the counter-signed copy yet. Hopefully it's in the
> queue somewhere. I wrote another patch mentioning the assignment time
> frame in the CONTRIBUTING file, since new contributors might assume
> something is wrong if they haven't heard back, but based on what I've
> read 6+ weeks is normal.

Please ping them and CC me.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-23 18:03           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-23 18:31             ` Eli Zaretskii
@ 2023-04-24 11:56             ` Eli Zaretskii
  2023-04-25 14:33             ` Eli Zaretskii
  2 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-24 11:56 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 62800

> From: Antero Mejr <antero@mailbox.org>
> Cc: 62800@debbugs.gnu.org
> Date: Sun, 23 Apr 2023 18:03:34 +0000
> 
> Updated patches are attached.

Thanks.

> > Also, this and your previous contributions exhaust the amount of
> > changes we can accept without a copyright assignment.  Would you like
> > to start the legal paperwork of assigning the copyright at this time,
> > so we could accept contributions from you in the future without
> > limitations?
> 
> I submitted all the paperwork in early March for my other pending patch,
> but haven't gotten the counter-signed copy yet. Hopefully it's in the
> queue somewhere.

OK, let's wait for a while to see if the paperwork comes through.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62800: [PATCH] eww: Use completion in URL/keyword prompt.
  2023-04-23 18:03           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-04-23 18:31             ` Eli Zaretskii
  2023-04-24 11:56             ` Eli Zaretskii
@ 2023-04-25 14:33             ` Eli Zaretskii
  2 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-25 14:33 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 62800-done

> From: Antero Mejr <antero@mailbox.org>
> Cc: 62800@debbugs.gnu.org
> Date: Sun, 23 Apr 2023 18:03:34 +0000
> 
> > Thanks.  The patches don't apply to the Emacs master branch.  Could
> > you please update them and re-post?  When you do so, please mention
> > the bug number in the commit log messages, to minimize the amount of
> > manual work required when installing the changes.
> 
> Updated patches are attached.

Thanks, now installed on the master branch, and closing the bug.

> I wrote another patch mentioning the assignment time frame in the
> CONTRIBUTING file, since new contributors might assume something is
> wrong if they haven't heard back, but based on what I've read 6+
> weeks is normal.

I see no need to install this part of your patches.  First, 6+ weeks
is somewhat longer than normal, and we will always ask to re-post
updated patches if they don't apply.

Thanks.





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-04-25 14:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-12 18:10 bug#62800: [PATCH] eww: Use completion in URL/keyword prompt Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-12 18:32 ` Juri Linkov
2023-04-12 19:44   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-12 21:43     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-13  1:31       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-13  6:41         ` Juri Linkov
2023-04-13  6:40     ` Juri Linkov
2023-04-13 17:16       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-22  9:03         ` Eli Zaretskii
2023-04-23 18:03           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-23 18:31             ` Eli Zaretskii
2023-04-24 11:56             ` Eli Zaretskii
2023-04-25 14:33             ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).