emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document backward-incompatible change in ORG-NEWS?


From: Nicolas Goaziou
Subject: Re: Document backward-incompatible change in ORG-NEWS?
Date: Tue, 25 Feb 2020 10:10:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello,

Bastien <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]