summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2020-03-24 12:32:21 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2020-03-24 12:32:21 +0100
commit5b96988706a2dd2e7d0e4cddd1686b80eec82584 (patch)
treec20fede709596254b55b293a5d6fd699b00c2dee
parent6ea1ca51a8d2a0f0c978478256c5ce552a8a4dde (diff)
downloadorg-mode-5b96988706a2dd2e7d0e4cddd1686b80eec82584.tar.gz
ol: Prettify suggested description for stored links
* lisp/ol.el (org-store-link): Remove statistics cookies and spurious white spaces from description, if possible.
-rw-r--r--lisp/ol.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/ol.el b/lisp/ol.el
index 89cf397..612694b 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1643,7 +1643,17 @@ non-nil."
(t (org-link-heading-search-string)))))
(when (org-string-nw-p context)
(setq cpltxt (format "%s::%s" cpltxt context))
- (setq desc (or name (org-get-heading t t t t) "NONE")))))
+ (setq desc
+ (or name
+ ;; Although description is not a search
+ ;; string, use `org-link--normalize-string'
+ ;; to prettify it (contiguous white spaces)
+ ;; and remove volatile contents (statistics
+ ;; cookies).
+ (and (not (org-before-first-heading-p))
+ (org-link--normalize-string
+ (org-get-heading t t t t)))
+ "NONE")))))
(setq link cpltxt)))))
((buffer-file-name (buffer-base-buffer))