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>

-----BEGIN PGP SIGNED MESSAGE-----
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: ? ")
        (org-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)
#+end_src

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.

WDYT?

- -- 
[ 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
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5T5xkUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsO2jgf+NXmuhKM7CyjoN0qq+DuKppTvkv5S
+iQUOOk5mGmRA8ayu6Veh1IJI5U/R61lXxYPJYzV6HIAuIG+Wz7c2UOUoJ4VJyf1
yp4sksY7d7/Uhak+hEjuQvsRWoT3F+80S251+kHcRkpyZZR41HLZVHlxLgGba6ub
DP+8X4EmxO3bOByK5ixAuGUPCqASfT+njSOFK7CUGDPlFt58dTb78Z/hj0b5/pv0
er0e0mS3m6matGAlsmb0A8GM+9I/TxqBGdc6SySUqNrVhGZFXMBt7090jllqb6Cq
SqGxUFUxI0G3vtZYp2kPPyaYCpb9OJlhKTVkd0PxCCWZrhuqKVyvx/OmNg==
=PJ1+
-----END PGP SIGNATURE-----

  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 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:
  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=87imjwf2ee.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [BUG] Recently master branch commit breaks open file: link' \
    /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

Code repositories for project(s) associated with this 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).