From e29e0ed4f2d56ff9f992a67c0e61db7af0b0bbc5 Mon Sep 17 00:00:00 2001
From: Dan Milstein <milstein.dan@gmail.com>
Date: Tue, 1 Jul 2025 22:23:48 -0400
Subject: [PATCH] lisp/org-refile.el: Replace links with their descriptions

* lisp/org-refile.el (org-refile-get-targets): Replace links with their descriptions in refile targets

If an org refile target was a link, the refile interface would show all of: the link, the description and the surrounding brackets. That was quite difficult to read in the compressed space of the minibuffer.

This change replaces the full link with just the description, which is easier to read.

A similar change was discussed on the mailing list in 2008, and apparently accepted -- but somehow lost from the refile code:

Link: https://list.orgmode.org/6CB4F483-0332-4F40-9CDF-99C90A9BD2B1@uva.nl/

TINYCHANGE
---
 lisp/org-refile.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index e15ba4134..5caed50a6 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -372,7 +372,8 @@ When `org-refile-use-cache' is nil, just return POS."
 		        (let ((re (format org-complex-heading-regexp-format
 					  (regexp-quote heading)))
 			      (target
-			       (if (not org-refile-use-outline-path) heading
+			       (if (not org-refile-use-outline-path)
+                                   (org-link-display-format heading)
 			         (mapconcat
 				  #'identity
 				  (append
-- 
2.43.0

