emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Bastien <bzg@gnu.org>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Document backward-incompatible change in ORG-NEWS?
Date: Tue, 25 Feb 2020 10:10:10 +0100	[thread overview]
Message-ID: <87mu97c9sd.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <874kvf67wd.fsf_-_@gnu.org> (Bastien's message of "Mon, 24 Feb 2020 21:35:14 +0100")

Hello,

Bastien <bzg@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

  parent reply	other threads:[~2020-02-25  9:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24  6:38 [BUG] Recently master branch commit breaks open file: link stardiviner
2020-02-24  8:41 ` Bastien
2020-02-24 12:06   ` stardiviner
2020-02-24 12:15     ` Bastien
2020-02-24 15:09       ` stardiviner
2020-02-24 20:30         ` Bastien
2020-02-24 20:35         ` Document backward-incompatible change in ORG-NEWS? (was: [BUG] Recently master branch commit breaks open file: link) Bastien
2020-02-24 21:31           ` Samuel Wales
2020-02-25  7:02             ` stardiviner
2020-02-25  9:10           ` Nicolas Goaziou [this message]
2020-02-25 19:34             ` Document backward-incompatible change in ORG-NEWS? Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mu97c9sd.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).