From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Document backward-incompatible change in ORG-NEWS? Date: Tue, 25 Feb 2020 10:10:10 +0100 Message-ID: <87mu97c9sd.fsf@nicolasgoaziou.fr> References: <87o8tofq1b.fsf@gmail.com> <87lfosz8ai.fsf@gnu.org> <87lfosfave.fsf@gmail.com> <87zhd8mba7.fsf@gnu.org> <87imjwf2ee.fsf@gmail.com> <874kvf67wd.fsf_-_@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51478) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6WEL-0007pl-FV for emacs-orgmode@gnu.org; Tue, 25 Feb 2020 04:10:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6WEK-0000W1-3H for emacs-orgmode@gnu.org; Tue, 25 Feb 2020 04:10:17 -0500 In-Reply-To: <874kvf67wd.fsf_-_@gnu.org> (Bastien's message of "Mon, 24 Feb 2020 21:35:14 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Bastien Cc: Org Mode Hello, Bastien 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