emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] Recently master branch commit breaks open file: link


From: stardiviner
Subject: Re: [BUG] Recently master branch commit breaks open file: link
Date: Mon, 24 Feb 2020 23:09:13 +0800
User-agent: mu4e 1.3.8; emacs 27.0.50

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Bastien <address@hidden> writes:

> Hi Stardiviner,
>
> stardiviner <address@hidden> 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 via email to

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