Subject: bug#74218: [PATCH] Ask confirmation before sending region to search engine.

From: Eli Zaretskii <[email-masked]>
Date: Wed, 06 Nov 2024 14:34:33 +0200

> Cc: Fabio Natali <[email-masked]>
> Date: Wed,  6 Nov 2024 00:46:46 +0000
> From:  Fabio Natali via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> * lisp/net/eww.el (eww-search-confirm-send-region,
> eww-search-words): With 'eww-search-words' (by default bound to 'M-s
> M-w') a user can type in some search terms and get back the results
> of a web search from a predefined search engine. If a region is
> selected, 'eww-search-words' will use that for the web search
> instead of prompting the user.

This should be reformatted according to our conventions, see
CONTRIBUTE.

> +(defcustom eww-search-confirm-send-region t
> +  "Non-nil if Emacs should confirm sending the selected region to
> +the configured search engine.  This is the default to mitigate the

The first line of a doc string should be a single complete sentence,
and should attempt to summarize what the function/variable does,
because some "apropos" commands show only the first line of each doc
string.

> +risk of accidental data leak.  Set this variable to nil to send
> +the region to the search engine straightaway."
> +  :version "30.0"

This should be "31.1".

> +      (when (or (not eww-search-confirm-send-region)
> +                (yes-or-no-p
> +                 (format-message
> +                  "Send region to the configured search engine? ")))

IMO, this should somehow try to indicate the problematic aspect of
doing this.  For example, maybe it should say

       Really send the entire region to the search engine?

It is also possible that short regions should be sent without any need
for confirmation.  In which case perhaps the variable should allow
integer values, not just nil and t.

In addition, I don't see any need to ask for confirmation when we are
not going to send anything to the search engine, so I think the test
for white-space region should be before the confirmation prompt, and
only if the region is going to be sent.

Last, but not least: this contribution almost exhausts the amount of
changes we can accept from you without a copyright assignment.  Would
you like to start at this time your legal paperwork of assigning the
copyright to the FSF, so that we could accept your future
contributions without limitations?  If so, I will send you the form to
fill and the instructions to go with it.

Thanks.