* [PATCH] Show human-readable link descriptions first when inserting links
@ 2012-01-11 16:23 Dave Abrahams
2012-04-23 13:15 ` Bastien
0 siblings, 1 reply; 3+ messages in thread
From: Dave Abrahams @ 2012-01-11 16:23 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 198 bytes --]
This patch makes it easy to select links from among a forest of
similar-looking machine-readable forms. Without it, the human-readable
descriptions tend to fall off the right side of the window.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Show-human-readable-link-descriptions-first-when-ins.patch --]
[-- Type: text/x-patch, Size: 1994 bytes --]
From fa9522e8dd1ef602574d0fb58f8f610ef82b15d7 Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dave@boostpro.com>
Date: Thu, 22 Sep 2011 15:11:27 -0400
Subject: [PATCH] Show human-readable link descriptions first when inserting
links
---
lisp/org.el | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 3953890..34ae6c4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9016,6 +9016,12 @@ Note: this function also decodes single byte encodings like
(setq s (replace-match "%40" t t s)))
s)
+(defun org-pretty-link (link)
+ "Return a human-digestible representation of a given LINK,
+whose car must be a raw link and whose cadr must be either a link
+description or nil."
+ (concat (or (cadr link) "<no description>") "\t[[" (car link) "]]"))
+
;;;###autoload
(defun org-insert-link-global ()
"Insert a link like Org-mode does.
@@ -9098,9 +9104,7 @@ be used as the default description."
Use TAB to complete link prefixes, then RET for type-specific completion support\n")
(when org-stored-links
(princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
- (princ (mapconcat
- (lambda (x)
- (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
+ (princ (mapconcat 'org-pretty-link
(reverse org-stored-links) "\n"))))
(let ((cw (selected-window)))
(select-window (get-buffer-window "*Org Links*" 'visible))
@@ -9109,7 +9113,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(org-fit-window-to-buffer))
(and (window-live-p cw) (select-window cw)))
;; Fake a link history, containing the stored links.
- (setq tmphist (append (mapcar 'car org-stored-links)
+ (setq tmphist (append (mapcar 'org-pretty-link org-stored-links)
org-insert-link-history))
(setq all-prefixes (append (mapcar 'car org-link-abbrev-alist-local)
(mapcar 'car org-link-abbrev-alist)
--
1.7.5.4
[-- Attachment #3: Type: text/plain, Size: 63 bytes --]
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Show human-readable link descriptions first when inserting links
2012-01-11 16:23 [PATCH] Show human-readable link descriptions first when inserting links Dave Abrahams
@ 2012-04-23 13:15 ` Bastien
2012-04-23 19:49 ` Dave Abrahams
0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2012-04-23 13:15 UTC (permalink / raw)
To: Dave Abrahams; +Cc: emacs-orgmode
Hi Dave,
Dave Abrahams <dave@boostpro.com> writes:
> This patch makes it easy to select links from among a forest of
> similar-looking machine-readable forms. Without it, the human-readable
> descriptions tend to fall off the right side of the window.
I applied a slightly modified version of this patch.
Thanks for your patience!
--
Bastien
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Show human-readable link descriptions first when inserting links
2012-04-23 13:15 ` Bastien
@ 2012-04-23 19:49 ` Dave Abrahams
0 siblings, 0 replies; 3+ messages in thread
From: Dave Abrahams @ 2012-04-23 19:49 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
on Mon Apr 23 2012, Bastien <bzg-AT-altern.org> wrote:
> Hi Dave,
>
> Dave Abrahams <dave@boostpro.com> writes:
>
>> This patch makes it easy to select links from among a forest of
>> similar-looking machine-readable forms. Without it, the human-readable
>> descriptions tend to fall off the right side of the window.
>
> I applied a slightly modified version of this patch.
Thank you!
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-23 19:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 16:23 [PATCH] Show human-readable link descriptions first when inserting links Dave Abrahams
2012-04-23 13:15 ` Bastien
2012-04-23 19:49 ` Dave Abrahams
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.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).