diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2020-03-24 12:32:21 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2020-03-24 12:32:21 +0100 |
commit | 5b96988706a2dd2e7d0e4cddd1686b80eec82584 (patch) | |
tree | c20fede709596254b55b293a5d6fd699b00c2dee | |
parent | 6ea1ca51a8d2a0f0c978478256c5ce552a8a4dde (diff) | |
download | org-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.el | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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)) |