Hello, Bastien <b...@gnu.org> writes:
> This is fixed in master but I won't if we should document this bug > fix in ORG-NEWS (or if org-store-link was just momentarily broken.) You are right. This deserves an entry in ORG-NEWS. > If org-store-link was storing the todo keyword, perhaps we can add > a command similar to this one to help users fix broken links: > > (defun org-fix-links () > "Fix ill-formatted internal links. > E.g. replace [[*TODO Headline][headline]] by [[*Headline][headline]]. > Go through the buffer and ask for the replacement." > (interactive) > (visible-mode 1) > (save-excursion > (goto-char (point-min)) > (while (re-search-forward org-link-any-re nil t) I think this is inefficient. It would be better to search directly for (format "\\[\\[\\*%s\\s-+" (regexp-opt org-todo-keywords-1 t)) > (let* ((raw (match-string 2)) > (desc (match-string 3)) > fix new) > (when (and raw desc Why does DESC matter here? We probably want to also replace [[*TODO foo]] > (string-match-p > (concat "^\*" (regexp-opt org-todo-keywords-1) Typo: the correct regexp is "^\\*" > "\\s-+\\(.+\\)$") > raw)) > (setq new (replace-regexp-in-string > (concat (regexp-opt org-todo-keywords-1) "\\s-+") > "" raw)) > (set-text-properties 0 (length new) nil new) Why do you remove all text properties? Also, see `org-no-properties'. Regards, -- Nicolas Goaziou