File 0010-Add-prefix-to-copy-link-to-Info-node.patch of Package emacs

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@thaodan.de>
Date: Wed, 15 Jan 2025 15:10:50 +0200
Subject: [PATCH] Add prefix to copy link to Info node

* lisp/info.el (Info-copy-current-node-name):
Add prefix to copy link to Info node.
---
 lisp/info.el | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/lisp/info.el b/lisp/info.el
index b314a7d77a79eebff1c1c44c88837fe60175abb4..0ea7c49f03efb5688ff7b235687038ad310cad14 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -4464,7 +4464,8 @@ Info-menu-update
 (defun Info-copy-current-node-name (&optional arg)
   "Put the name of the current Info node into the kill ring.
 The name of the Info file is prepended to the node name in parentheses.
-With a zero prefix arg, put the name inside a function call to `info'."
+With a zero prefix ARG, put the name inside a function call to `info'.
+If ARG is 4 put link to Info node from `Info-url-alist.' into the kill ring."
   (interactive "P" Info-mode)
   (unless Info-current-node
     (user-error "No current Info node"))
@@ -4475,6 +4476,22 @@ Info-copy-current-node-name
 			  Info-current-node))))
     (if (zerop (prefix-numeric-value arg))
         (setq node (concat "(info \"" node "\")")))
+    (if (equal (prefix-numeric-value arg) 4)
+        (let (filename)
+          (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
+		        node)
+          (setq filename (if (= (match-beginning 1) (match-end 1))
+		             ""
+		           (match-string 2 node))
+	        node (match-string 3 node))
+          (let ((trim (string-match "\\s +\\'" filename)))
+            (if trim (setq filename (substring filename 0 trim))))
+          (let ((trim (string-match "\\s +\\'" node)))
+            (if trim (setq node (substring node 0 trim))))
+          (if (equal filename "")
+              (setq filename (file-name-sans-extension (file-name-nondirectory
+                                                        Info-current-file))))
+          (setq node (Info-url-for-node (format "(%s)%s" filename node)))))
     (unless (stringp Info-current-file)
       (setq node (format "(Info-find-node '%S '%S)"
 			 Info-current-file Info-current-node)))
openSUSE Build Service is sponsored by