emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] Recently master branch commit breaks open file: link
Date: Mon, 24 Feb 2020 23:09:13 +0800	[thread overview]
Message-ID: <87imjwf2ee.fsf@gmail.com> (raw)
In-Reply-To: <87zhd8mba7.fsf@gnu.org>

Hash: SHA256

Bastien <bzg@gnu.org> writes:

> Hi Stardiviner,
> stardiviner <numbchild@gmail.com> writes:
>> So I did a git bisect. Found this bad commit caused this problem
>> "afd3b04ec * bad ol: Extend open tooling in link parameters".
> This will work:
> #+begin_src org
> [[file:~/Org/Tasks/Computer Todos.org::*厉害的人是怎么分析问题的?][厉害的人是怎么分析问题的?]]
> #+end_src
> org-store-link used to store the TODO keyword, which was a mistake.
> Nicolas fixed this recently, now org-store-link DTRT and C-c C-o on
> stored links will work correctly.

I see. Thanks for explanation.

> IMHO we may have several file links such as yours broken: Nicolas,
> do you think the bugfix should be advertized in ORG-NEWS, along with
> a helper function to fix file links (ie remove the TODO keyword and
> priority cookies)?

This broken update might need a little think.

The new org-store-link does not include the TODO keyword. But what if user add
keyword before, then later does not use it in Org Mode config. This TODO keyword
will caused broken.

I personally used to have an advice on org-store-link to auto prompt user a
"CUSTOM_ID" property with default value of headline string before (A month ago I
disabled it).

#+begin_src emacs-lisp
;;; use :CUSTOM_ID: property for org headlines linking.
(defun org-store-link-set-headline-custom-id (arg &optional interactive?)
  "Set property :CUSTOM_ID: for `org-store-link' on headline."
  (when (and (equal major-mode 'org-mode) ; handle case `org-store-link' not in org-mode file.
             (not (org-before-first-heading-p)) ; handle case point is in org-mode buffer ahead of first headline.
             ;; (org-on-heading-p t) ; detect whether on a headline
             ;; (re-search-backward (concat "^\\(?:" outline-regexp "\\)") nil t) ; detect whether under a headline?
             (not (region-active-p)) ; handle `org-drill' capture word case.
             (not (org-entry-get nil "CUSTOM_ID")))
    (if (yes-or-no-p "Set property :CUSTOM_ID: ? ")
         (read-from-minibuffer "Property :CUSTOM_ID: value: "
                               (substring-no-properties (org-get-heading t t)))))))

(advice-add 'org-store-link :before #'org-store-link-set-headline-custom-id)

Is this solution will be better than headline link? Because it does not have to
consider TODO keyword, tags, end checkbox statistic etc. I know Org Mode has a
similar feature called ~org-id-link-to-org-use-id~. But I don't like meaningless
ID personally.


- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


  reply	other threads:[~2020-02-24 15: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 [this message]
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           ` Document backward-incompatible change in ORG-NEWS? Nicolas Goaziou
2020-02-25 19:34             ` 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:

  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=87imjwf2ee.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \


* 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


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).