From unknown Tue Jun 17 20:15:24 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#77016 <77016@debbugs.gnu.org> To: bug#77016 <77016@debbugs.gnu.org> Subject: Status: [PATCH] Use region as suggested URI in eww by default Reply-To: bug#77016 <77016@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:15:24 +0000 retitle 77016 [PATCH] Use region as suggested URI in eww by default reassign 77016 emacs submitter 77016 Manuel Giraud severity 77016 wishlist tag 77016 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 14 13:13:43 2025 Received: (at submit) by debbugs.gnu.org; 14 Mar 2025 17:13:43 +0000 Received: from localhost ([127.0.0.1]:35892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tt8bO-0002Xd-P4 for submit@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 ) id 1tt8bK-0002XE-TP for submit@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 ) id 1tt8bB-0007dT-Mn for bug-gnu-emacs@gnu.org; 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 ) id 1tt8b4-0005Wp-JS for bug-gnu-emacs@gnu.org; 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 ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id cdb5a67e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 14 Mar 2025 18:13:19 +0100 (CET) From: Manuel Giraud To: bug-gnu-emacs@gnu.org Subject: [PATCH] Use region as suggested URI in eww by default X-Debbugs-Cc: Lars Magne Ingebrigtsen Date: Fri, 14 Mar 2025 18:13:18 +0100 Message-ID: <875xkbpmc1.fsf@ledu-giraud.fr> 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@ledu-giraud.fr; 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 14 15:04:54 2025 Received: (at 77016) by debbugs.gnu.org; 14 Mar 2025 19:04:54 +0000 Received: from localhost ([127.0.0.1]:36269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttAKz-0008HX-Po for submit@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 ) id 1ttAKw-0008HG-L9 for 77016@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@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 In-Reply-To: <875xkbpmc1.fsf@ledu-giraud.fr> References: <875xkbpmc1.fsf@ledu-giraud.fr> MIME-Version: 1.0 Date: Fri, 14 Mar 2025 12:04:42 -0700 X-Gm-Features: AQ5f1JpBLhekgSzGKibG8tkRiXVaOyrQOBwOEHsXXVq7AXW5jGidDvkR2hVSiwo Message-ID: Subject: Re: bug#77016: [PATCH] Use region as suggested URI in eww by default To: Manuel Giraud , 77016@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77016 Cc: Lars Magne Ingebrigtsen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Manuel Giraud 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 15 08:02:05 2025 Received: (at control) by debbugs.gnu.org; 15 Mar 2025 12:02:05 +0000 Received: from localhost ([127.0.0.1]:39457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttQDM-0008Dj-5w for submit@debbugs.gnu.org; Sat, 15 Mar 2025 08:02:04 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:48426) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ttQCH-00089D-8Q for control@debbugs.gnu.org; Sat, 15 Mar 2025 08:00:57 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5e5e34f4e89so5294551a12.1 for ; Sat, 15 Mar 2025 05:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742040051; x=1742644851; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=w6UyMHd2CErbbDLM5e/rDoMHUu+jl4w5S1skFMWtIqs=; b=h7rh/TZGznmMz+1XD94/Q/Jt3MOvZO326c9hPCw+cy39LLZxE3v8a3WrGKb2J4W7Vv GR2yFIT+SbBWhCWQTvQBb5vHr/WNbjsddkj+8VVS1++471C6+m5YRR8Dq1vbWxAK4tqE F9xFXhOPUoUiZIp7Qh7HqEAkHroPlC+t47TdsZAS3OZJS1+N22bqQKvZ2lmYuTS8ihHS oCm4QQ9JvUNDQaZjMkOaZrZJoohdjH2qZw7BtEgnkLqi4lKM6cjl98hqeO7daCB7Jgbc W4HNzudeJTCytkBX1RGlVPN3SFQIZGJkM95a2vBmSje8NQAOuk5pTBwRExhYfNxbZHme yTAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742040051; x=1742644851; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=w6UyMHd2CErbbDLM5e/rDoMHUu+jl4w5S1skFMWtIqs=; b=JE8KweMjjbelV+uF9rGt0YpGXt7oncG5oP+eQ2t3pGugNUz3TWAbJe3PUX8ZZebxve PGfauxByeEfLFPrYqgwgfsKxGuHXV+AF3ZrzTf+LVHNpm2Os7T6E4D6pPjsUtK9tN0gs 2ZBEGq0LuEp+gi6eH1a8CI6ScmvfXQzAR2OCYHwc1b1RsC4Zg/ZYWiK+DJZ0qHaXJ4yR oz8A7pT9yXr8/SNCI/IWEmc6xtC6jklf9H6bSBqca0tPyJKjJF9gD4hyIjXIymUzelpo 6/WNhkSiwpT2meGKS+PUzTal0qKLUjD/74NMrbH2U2vGekefv09qwJgDnyeJR2pNbWj+ nmZw== X-Gm-Message-State: AOJu0Yw/s6Qyk4ICbW/839EAMnML3vUzDg7AF5IZjt8YtKnB/zJUlMwQ 8463OkSWSv8FrZG1bhy+SXyEqUMmEgXkYU6OpJPdiXSHt763lgK85Nj7ULi/III1frnyhWmbm3m GIZ9Br+kKYAPPAOLezbgG1YuqqcZEO5l+RLQ= X-Gm-Gg: ASbGncsnRAiOGZUb+sxELaamCorXwkqNS1SeEz2e7LqR1HucDTj+B+U2C7jVXzDa9h2 PARaTJjmk086VHtOamUztHUPc/nBj41AWlAyjs3aKsWFyMhfDfLEo6oFfw66L2r1vujxW7pwUXH 4A04eVK9kVLMuzoB7BS8/TZJ7qWqEO X-Google-Smtp-Source: AGHT+IHqVrXgMLFySJ1pxlLNUAy4GU4m/BPkhDYKnkASZ0u1EIl5mqmXb4hnv/MSwIqodDNrTUOZ7+hgA+v7nGngNHY= X-Received: by 2002:a05:6402:35cb:b0:5e4:a88a:64e with SMTP id 4fb4d7f45d1cf-5e89f34482fmr6809601a12.5.1742040051155; Sat, 15 Mar 2025 05:00:51 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 15 Mar 2025 07:00:50 -0500 From: Stefan Kangas MIME-Version: 1.0 Date: Sat, 15 Mar 2025 07:00:50 -0500 X-Gm-Features: AQ5f1JrXk74_cQ7COrUSoKKgq4IXXW57QsqagYtm_AXVi3Bv_TDHe5Og-pcBJt4 Message-ID: Subject: control message for bug #77016 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 77016 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 15 10:55:54 2025 Received: (at 77016) by debbugs.gnu.org; 15 Mar 2025 14:55:54 +0000 Received: from localhost ([127.0.0.1]:43094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttSvY-0004KW-AI for submit@debbugs.gnu.org; Sat, 15 Mar 2025 10:55:53 -0400 Received: from ledu-giraud.fr ([51.159.28.247]:36551) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ttSvT-0004Jm-RV for 77016@debbugs.gnu.org; Sat, 15 Mar 2025 10:55:49 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=7JlzTp6C 4PiCtFEC1Fsg6FHCglvSo1usbmQcAx+3PVo=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=JFzSgN91E4SEF37kG8TovgNDF7nHWU y/tF7CDyGZXhMUUFlP7zSXgJH+hfCLLr13sNfblV5KOORk+sfyZezvBg== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=7JlzTp6C4PiCtFEC 1Fsg6FHCglvSo1usbmQcAx+3PVo=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=JKpVukXcZfNyaooB5OlPb5hBFTOpSsHKDk5Ze5 AdPW8y3kAMxqnI+mq5t5bSPBqH2fhIjJZzQGV6zSFzo7MdDjCIoVKmOnPd90gfzH7FdxQ3 CcphgVm2N9J2OvK3s3Dmh3aVrADOV7yHF5nn9FF77OCtcNzxigDlHBfyPr3Sv//jae7HsA pcjV5msdEbF8VzVdJm4EbSnzLwfYXoEzPWiL8mhDuoAPaxwjFJRIn1bkW7J/8IAN3WKTkN kZTtyYM7m1hvogMgfjfWM1QY40CFjWcuUtNePaVHOLip8468WPPHJRYAsRGdaH6MGyasXX Z1zYF513ctHBDamO0vODXLOQ== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 03a2326f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 15 Mar 2025 15:55:44 +0100 (CET) From: Manuel Giraud To: Stefan Kangas Subject: Re: bug#77016: [PATCH] Use region as suggested URI in eww by default In-Reply-To: References: <875xkbpmc1.fsf@ledu-giraud.fr> Date: Sat, 15 Mar 2025 15:55:42 +0100 Message-ID: <87cyeitkb5.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77016 Cc: 77016@debbugs.gnu.org, Lars Magne Ingebrigtsen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Stefan Kangas writes: > Manuel Giraud 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. Thanks for your review. What about this new one? I'm not quite sure about the 'deactivate-mark' (and its place) but if I don't do this a "wrong" region is active in the new "web search" buffer. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Use-region-as-suggested-URI-in-EWW.patch >From 32f220030e5a46c11816f43001272a620e8856e5 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Fri, 14 Mar 2025 18:03:20 +0100 Subject: [PATCH] Use region as suggested URI in EWW * lisp/net/eww.el (eww-current-region): New function to extract the current region. (eww-dwim-region): New user option to guard it. (eww-suggest-uris): Use 'eww-current-region' first as suggested URI. (eww--open-url-in-new-buffer): Deactivate the mark in the cloned buffer. * etc/NEWS: Annouce user option. --- etc/NEWS | 10 ++++++++-- lisp/net/eww.el | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 7467af6055c..539d1001564 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -363,8 +363,6 @@ invoked standalone or from the 'project-switch-commands' dispatch menu. This user option describes projects that should always be skipped by 'project-remember-project'. -*** - ** Registers *** New functions 'buffer-to-register' and 'file-to-register'. @@ -373,6 +371,14 @@ Killed buffers stored in a register using 'buffer-to-register' are automatically converted to a file-query value if the buffer was visiting a file. +** EWW + +--- +*** New user option 'eww-dwim-region'. +If non-nil, the user selected region is used as the default suggested +URI by EWW. For example, this would trigger a web search when used with +'M-RET'. By default this option is nil. + ** IDLWAVE has been moved to GNU ELPA. The version bundled with Emacs is out-of-date, and is now marked as obsolete. Use 'M-x list-packages' to install the 'idlwave' package from diff --git a/lisp/net/eww.el b/lisp/net/eww.el index caee50a712f..d64acf37c5b 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -102,9 +102,18 @@ eww-download-directory :group 'eww :type '(choice directory function)) +(defcustom eww-dwim-region nil + "When non-nil, the current region is used by `eww' as the default +suggested URI. This allows to trigger a web search on the user +selection." + :version "31.1" + :group 'eww + :type 'boolean) + ;;;###autoload (defcustom eww-suggest-uris - '(eww-links-at-point + '(eww-current-region + eww-links-at-point thing-at-point-url-at-point eww-current-url eww-bookmark-urls) @@ -634,6 +643,7 @@ eww--open-url-in-new-buffer (if (eq major-mode 'eww-mode) (clone-buffer) (generate-new-buffer "*eww*")) (unless (equal url (eww-current-url)) + (deactivate-mark) (eww-mode) (eww (if (consp url) (car url) url))))) @@ -1106,6 +1116,12 @@ eww-current-url "Return URI of the Web page the current EWW buffer is visiting." (plist-get eww-data :url)) +(defun eww-current-region () + "Return the current region content if there is one and the user option +`eww-dwim-region' is non-nil." + (when (and eww-dwim-region (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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 15 14:41:20 2025 Received: (at 77016) by debbugs.gnu.org; 15 Mar 2025 18:41:20 +0000 Received: from localhost ([127.0.0.1]:43550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttWRj-0000FN-OY for submit@debbugs.gnu.org; Sat, 15 Mar 2025 14:41:20 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:49549) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ttWRg-0000Ee-Ku for 77016@debbugs.gnu.org; Sat, 15 Mar 2025 14:41:17 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 7BA70432E9; Sat, 15 Mar 2025 18:41:07 +0000 (UTC) From: Juri Linkov To: Manuel Giraud Subject: Re: bug#77016: [PATCH] Use region as suggested URI in eww by default In-Reply-To: <87cyeitkb5.fsf@ledu-giraud.fr> Organization: LINKOV.NET References: <875xkbpmc1.fsf@ledu-giraud.fr> <87cyeitkb5.fsf@ledu-giraud.fr> Date: Sat, 15 Mar 2025 20:33:34 +0200 Message-ID: <87frje18pt.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufeeggeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopeejjedtudeiseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepshhtvghfrghnkhgrnhhgrghssehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhgrnhhuvghlsehlvgguuhdqghhirhgruhgurdhfrh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 77016 Cc: 77016@debbugs.gnu.org, Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > +(defcustom eww-dwim-region nil > + "When non-nil, the current region is used by `eww' as the default > +suggested URI. This allows to trigger a web search on the user > +selection." > + :version "31.1" > + :group 'eww > + :type 'boolean) > + > ;;;###autoload > (defcustom eww-suggest-uris > - '(eww-links-at-point > + '(eww-current-region > + eww-links-at-point > thing-at-point-url-at-point > eww-current-url > eww-bookmark-urls) If we don't want to enable this by default then better to add 'eww-current-region' to :options of the existing user option than to create a duplicating option.