GNU bug report logs - #77016
[PATCH] Use region as suggested URI in eww by default

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Manuel Giraud <manuel@HIDDEN>; Keywords: patch; dated Fri, 14 Mar 2025 17:14:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 77016 <at> debbugs.gnu.org:


Received: (at 77016) by debbugs.gnu.org; 14 Mar 2025 19:04:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 14 15:04:54 2025
Received: from localhost ([127.0.0.1]:36269 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ttAKz-0008HX-Po
	for submit <at> debbugs.gnu.org; Fri, 14 Mar 2025 15:04:54 -0400
Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:52228)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1ttAKw-0008HG-L9
 for 77016 <at> debbugs.gnu.org; Fri, 14 Mar 2025 15:04:51 -0400
Received: by mail-ed1-x52a.google.com with SMTP id
 4fb4d7f45d1cf-5e61d91a087so3765778a12.0
 for <77016 <at> debbugs.gnu.org>; Fri, 14 Mar 2025 12:04:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1741979084; x=1742583884; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=2JGSOYMZr2B2E4lafpAqkcM5jGwwyv2nB+MUbiJIAc8=;
 b=Mh4CKq9SqJrDG3RuwIK3HVZS6IoPZkKavD6EPFT0ERpt/swfp2MYe2INVhZxJEnKyF
 sepNRcuwj2gL2qRwoZytnX4tqGcf/E3hOwUXbvycGCvPHUoUil4AlUc2BpWU6AmCoQDh
 m3Vl3lQnpYxWb28FAlr/wziv+6BOl6DoPcSMlUG+lBC2dp+brYpMkjHA+5Wq7OrDyLiq
 k9CaVrs6V8RjtSQZ6EK/emIf5qyVUjdLCLFQsWIyRdhE5GIiAML0QemSUr0cW+x6hqk1
 YoWas5uSdNBqJ8hc3FQ5gKppSM4eDyBhh12ziwwXKPJnEZplaZ3a/Tuf4Uor2tGFOf6C
 wmGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1741979084; x=1742583884;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=2JGSOYMZr2B2E4lafpAqkcM5jGwwyv2nB+MUbiJIAc8=;
 b=dwM1u9PHKyQ9ZeghLOkZ2n+tFkKj1VlUqUIVR/osmVABr0qDP8zaTKyF2ti2mIKOrp
 R712+yB1Noh/he1K/2EaojoxTkDpj0oJ9yk5Ub3iFyUerqznjadIquHGlqpWemJTL+Uz
 8rRP5E1hpxm6m6xueZen9d/txFwZ8MQsO+5ti5poEyx9eE0yqzGV4RGzbaIL8BIdDVLm
 B/cKQ+0EPn3xV9nPUQ9VfNC4e3M1xJ9zT1wcv8mI6m3kL4tABGMXbyxDrsPGD4kfNFPI
 HTr1M1qt9N/GGDEW09XIKogIA4tvjvcq/E2ZMEeba/Z6noKDtIqSjTHXzhmglC62gIu+
 cl8w==
X-Forwarded-Encrypted: i=1;
 AJvYcCWNe2yMj1bdI/HqCMPsJIZH4Ipj76cvVazhGV4dfFoC7mde2A6cyzWf6CJ5mS9RKn51aeB6BA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyD6o9yCdKAMx/0o4grzCHKNXLSESOMek3VoIpsiFTOT/nd3MN+
 I8gD7FOzr6A+CsQrCIAMKKb8S94CL6lT4tU+pjIpZlrJtbZwF45ArHmN8TAAjHjSoBp4C/+BlSc
 oUd5nvyvixVriunqjwzvWIvvHc6hRGEEmXYc=
X-Gm-Gg: ASbGnctTIjVkF5lf4BHdJyrW/jd+/rkauHtNH4/EC0EESgFD7o3yjRI7Tn3g0J5H6cD
 6Sy7p9FszOD3Cav4/U0keflJuezS6aQdFxa6v5hf+PYk3rBxEAWR5cfJGcJWDHWvZfadpRZDgYG
 GhCRuOWTn2DcvpkNQ/fUp7xyijaA==
X-Google-Smtp-Source: AGHT+IFhfFgpPbeNU9QEqOgieRvIg3GgVutF8UgOo+ElELrb0YGzYulWSroyGOckVJ8hUtx3cXVNo23v9Kf3PhWo8h4=
X-Received: by 2002:a05:6402:5cd:b0:5e5:c76f:c019 with SMTP id
 4fb4d7f45d1cf-5e89fa3953dmr3938884a12.17.1741979083904; Fri, 14 Mar 2025
 12:04:43 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 14 Mar 2025 12:04:42 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <875xkbpmc1.fsf@HIDDEN>
References: <875xkbpmc1.fsf@HIDDEN>
MIME-Version: 1.0
Date: Fri, 14 Mar 2025 12:04:42 -0700
X-Gm-Features: AQ5f1JpBLhekgSzGKibG8tkRiXVaOyrQOBwOEHsXXVq7AXW5jGidDvkR2hVSiwo
Message-ID: <CADwFkm=2U=mez9mDG5XGZfyETP_HVGnE1tHukBzpus_zFGz-Dw@HIDDEN>
Subject: Re: bug#77016: [PATCH] Use region as suggested URI in eww by default
To: Manuel Giraud <manuel@HIDDEN>, 77016 <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 77016
Cc: Lars Magne Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Manuel Giraud <manuel@HIDDEN> writes:

> Here is a patch for eww.  It adds the current region on top of the
> suggested URI.  This way when reading a page in eww, one can select a
> region and hit "M-RET" to open a new window (or tab) with a web search
> for this selection.  WDYT?

This is a change in behavior, and I can see that it would be useful to
some users.  However, there are many reasons why one would _not_ want
this behavior by default, and it feels risky to have this level of DWIM
by default.

I think it should be optional and/or behind a prompt.

This should be documented in NEWS.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#77016; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Mar 2025 17:13:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 14 13:13:43 2025
Received: from localhost ([127.0.0.1]:35892 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tt8bO-0002Xd-P4
	for submit <at> debbugs.gnu.org; Fri, 14 Mar 2025 13:13:43 -0400
Received: from lists.gnu.org ([2001:470:142::17]:48552)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <manuel@HIDDEN>)
 id 1tt8bK-0002XE-TP
 for submit <at> debbugs.gnu.org; Fri, 14 Mar 2025 13:13:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <manuel@HIDDEN>)
 id 1tt8bB-0007dT-Mn
 for bug-gnu-emacs@HIDDEN; Fri, 14 Mar 2025 13:13:30 -0400
Received: from ledu-giraud.fr ([51.159.28.247])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <manuel@HIDDEN>)
 id 1tt8b4-0005Wp-JS
 for bug-gnu-emacs@HIDDEN; Fri, 14 Mar 2025 13:13:28 -0400
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=x0OHc4x2
 XVneLwooATJSXP9cvRW50WgYw7T/RiDw6Qw=; h=date:subject:to:from; 
 d=ledu-giraud.fr;
 b=jrxlBa6W2Ek0lZ1nDuuLDwXi4FZE/xnRq5xYf/oO1wItQvBhf7
 QvLlMBnTdXJfCdff3lBi9pPuz5JgL0oaZZDQ==
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=x0OHc4x2XVneLwoo
 ATJSXP9cvRW50WgYw7T/RiDw6Qw=; h=date:subject:to:from;
 d=ledu-giraud.fr; b=uU57z8+HpoOPpXGsg6/5GTmLQ66tTvi38ooiDKErbgFAsh7IAY
 pckcbtdEHU4EDtJRYGWMGYEJYcyOq5QzEyaYNDm4tgQKWdImBlo1F60T4fA4/9d9e55Oen
 OH+A86p3IdAnqNz4P5fBAaku7LZJ1NIn0UWdXto56zIjm/cSMlvG5QOCzRzVsuRw9ZRH3h
 qP66EOyuPjhmWgGti0Y7h2Xzq7sF0t0I4l85bS+uYMfZY6jgZzgYtqTmY9EeAw8v6m7g4T
 2OImoKP/p592naKp4R22u1xldQm0jcCjQVotGFG6ch3VqmTgaOkB7m6tsUrRSpbyyDchNF
 3o8r9oDJMxNg==
Received: from computer (<unknown> [10.1.1.1])
 by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id cdb5a67e
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <bug-gnu-emacs@HIDDEN>;
 Fri, 14 Mar 2025 18:13:19 +0100 (CET)
From: Manuel Giraud <manuel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Use region as suggested URI in eww by default
X-Debbugs-Cc: Lars Magne Ingebrigtsen <larsi@HIDDEN>
Date: Fri, 14 Mar 2025 18:13:18 +0100
Message-ID: <875xkbpmc1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@HIDDEN;
 helo=ledu-giraud.fr
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

--=-=-=
Content-Type: text/plain

Tags: patch

Hi,

Here is a patch for eww.  It adds the current region on top of the
suggested URI.  This way when reading a page in eww, one can select a
region and hit "M-RET" to open a new window (or tab) with a web search
for this selection.  WDYT?


In GNU Emacs 31.0.50 (build 38, x86_64-unknown-openbsd7.7, X toolkit) of
 2025-03-14 built on computer
Repository revision: 1437fc2bca2e42cd2a28754bbb4d9ac1403b87b7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: OpenBSD computer 7.7 GENERIC.MP#593 amd64

Configured using:
 'configure CC=egcc CPPFLAGS=-I/usr/local/include
 LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
 --bindir=/home/manuel/bin --with-x-toolkit=lucid
 --with-toolkit-scroll-bars=no --without-cairo
 --without-compress-install'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Use-region-as-suggested-URI-in-eww-by-default.patch

From 49ca25f051ea4d87542204049e0eff25ea6bdbed Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@HIDDEN>
Date: Fri, 14 Mar 2025 18:03:20 +0100
Subject: [PATCH] Use region as suggested URI in eww by default

* lisp/net/eww.el (eww-region): New function to extract the
selected region.
(eww-suggest-uris): Use it first as suggested URI.
---
 lisp/net/eww.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index caee50a712f..02583da4399 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -104,7 +104,8 @@ eww-download-directory
 
 ;;;###autoload
 (defcustom eww-suggest-uris
-  '(eww-links-at-point
+  '(eww-region
+    eww-links-at-point
     thing-at-point-url-at-point
     eww-current-url
     eww-bookmark-urls)
@@ -1106,6 +1107,11 @@ eww-current-url
   "Return URI of the Web page the current EWW buffer is visiting."
   (plist-get eww-data :url))
 
+(defun eww-region ()
+  "Return the current region content if there is one."
+  (when (use-region-p)
+    (buffer-substring (region-beginning) (region-end))))
+
 (defun eww-links-at-point ()
   "Return list of URIs, if any, linked at point."
   (seq-filter #'stringp
-- 
2.48.1


--=-=-=
Content-Type: text/plain

-- 
Manuel Giraud

--=-=-=--




Acknowledgement sent to Manuel Giraud <manuel@HIDDEN>:
New bug report received and forwarded. Copy sent to larsi@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to larsi@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#77016; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 15 Mar 2025 12:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.