org.el (org-sort-remove-invisible): Truly returns the visible part of the string

* org.el (org-sort-remove-invisible): Use defsust.  Do not
only check against invisible links, truly returns the visible
part of the string.

Thanks to François Pinard for suggesting this.
This commit is contained in:
Bastien Guerry 2013-02-25 10:24:29 +01:00
parent 5700a0eb2d
commit 30d6dc8baa
1 changed files with 7 additions and 8 deletions

View File

@ -8319,14 +8319,13 @@ Optional argument WITH-CASE means sort case-sensitively."
(t (t
(org-call-with-arg 'org-sort-entries with-case)))) (org-call-with-arg 'org-sort-entries with-case))))
(defun org-sort-remove-invisible (s) (defsubst org-sort-remove-invisible (s)
"Remove invisible links from string S." "Return the visible string from string S."
(remove-text-properties 0 (length s) org-rm-props s) (let (result)
(while (string-match org-bracket-link-regexp s) (dotimes (c (length s))
(setq s (replace-match (if (match-end 2) (let ((st (substring s c (1+ c))))
(match-string 3 s) (unless (get-text-property 0 'invisible st) (push st result))))
(match-string 1 s)) t t s))) (mapconcat 'identity (reverse result) "")))
s)
(defvar org-priority-regexp) ; defined later in the file (defvar org-priority-regexp) ; defined later in the file