unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60213: [PATCH] Copy Info-goto-node-web URL as kill with prefix argument
@ 2022-12-20  4:44 Stefan Kangas
  2022-12-20 14:04 ` Eli Zaretskii
  2022-12-20 17:24 ` Drew Adams
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Kangas @ 2022-12-20  4:44 UTC (permalink / raw)
  To: 60213

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

Severity: wishlist

The attached patch make `Info-goto-node-web' copy the URL as kill with a
prefix argument, instead of opening it with `browse-url'.  I've seen
this feature requested a couple of times now by various people.

Since `Info-goto-node-web' is new in Emacs 29, this could perhaps be
considered safe enough for emacs-29, but master is also fine, of course.

[-- Attachment #2: 0002-Copy-Info-goto-node-web-URL-as-kill-with-prefix-arg.patch --]
[-- Type: text/x-diff, Size: 2246 bytes --]

From 76593b37c06c18920cb2c1f704bbd1590d59e471 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Tue, 20 Dec 2022 05:35:03 +0100
Subject: [PATCH 2/2] Copy Info-goto-node-web URL as kill with prefix arg

* lisp/info.el (Info-goto-node-web): Copy URL as kill with prefix
argument.
---
 lisp/info.el | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/lisp/info.el b/lisp/info.el
index f939c42874..8c689147dc 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1781,17 +1781,27 @@ Info-goto-node
     (Info-find-node (if (equal filename "") nil filename)
                     (if (equal nodename "") "Top" nodename) nil strict-case)))
 
-(defun Info-goto-node-web (node)
+(defun Info-goto-node-web (node &optional arg)
   "Use `browse-url' to go to the gnu.org web server's version of NODE.
-By default, go to the current Info node."
+By default, go to the current Info node.
+
+With a prefix argument ARG, copy the URL to the kill ring instead
+of visiting."
   (interactive (list (Info-read-node-name
-                      "Go to node (default current page): " Info-current-node))
+                      (if current-prefix-arg
+                          "Copy node URL as kill (default current page): "
+                        "Go to node (default current page): ")
+                      Info-current-node)
+                     current-prefix-arg)
                Info-mode)
-  (browse-url-button-open-url
-   (Info-url-for-node (format "(%s)%s" (file-name-sans-extension
-                                        (file-name-nondirectory
-                                         Info-current-file))
-                              node))))
+  (let ((url (Info-url-for-node (format "(%s)%s" (file-name-sans-extension
+                                                  (file-name-nondirectory
+                                                   Info-current-file))
+                                        node))))
+    (if current-prefix-arg
+        (progn (kill-new url)
+               (message "%s" url))
+      (browse-url-button-open-url url))))
 
 (defvar info--url-for-node-manuals-built-in
   ;; All manuals are at https://www.gnu.org/software/emacs/manual/
-- 
2.35.1


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

end of thread, other threads:[~2022-12-21 16:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-20  4:44 bug#60213: [PATCH] Copy Info-goto-node-web URL as kill with prefix argument Stefan Kangas
2022-12-20 14:04 ` Eli Zaretskii
2022-12-20 17:24 ` Drew Adams
2022-12-21  1:57   ` Stefan Kangas
2022-12-21  6:01     ` Drew Adams
2022-12-21  8:36       ` Stefan Kangas
2022-12-21 16:07         ` Drew Adams
2022-12-21  8:30     ` Juri Linkov
2022-12-21 16:05       ` Drew Adams

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).