awth13 / org-appear

Toggle visibility of hidden Org mode element parts upon entering and leaving an element
MIT License
383 stars 19 forks source link

org-appear does not trigger in links in comments! #18

Open japhir opened 3 years ago

japhir commented 3 years ago

if I have an org file with a link on a commented (#) line, it does not appear!

Org mode is awesome!
# note to self: [[https://orgmode.org][org-mode]] is where I got the above info from
japhir commented 3 years ago

this is probably because it's also not indicated as a link in any other way, so may be an upstream bug?

awth13 commented 3 years ago

Hey, @japhir!

Comments do not have children elements in the org-element API and org-appear cannot detect elements within a comment. The part of Org that hides links uses a different mechanism, though. If you M-x org-toggle-link-display in a buffer with your example text, the full link will be hidden.

wxxxcxx commented 3 years ago

There is a similar problem in the document title.

+title: Test [[id:7ef1a2d7-7847-415e-b777-b1eb583636e6][Test]]

wowhxj commented 3 years ago

I also encountered the problem in normal org region for links. test

awth13 commented 3 years ago

@wowhxj, this looks like a different issue. I also can't reproduce it.

Would you mind telling me which version of Emacs/Org are you using and what is the value of org-appear-autolinks? How did you insert the link? Do you have any special configuration that affects Org links?

wowhxj commented 3 years ago

@wowhxj, this looks like a different issue. I also can't reproduce it.

Would you mind telling me which version of Emacs/Org are you using and what is the value of org-appear-autolinks? How did you insert the link? Do you have any special configuration that affects Org links?

I'm using GNU Emacs 27.2 with Org mode version 9.4.6 (9.4.6-4-g093c94-elpaplus).

The value of org-appear-autolinks is nil.

I use C-c C-l which stands for org-insert-link command to insert a URL link.

Following is the text of the link:

[[https://github.com/awth13/org-appear][org-appear]]

My configuration for org link is as following:

(setq org-return-follows-link nil)

(use-package ol
  :ensure nil
  :after org
  :custom
  (org-link-keep-stored-after-insertion t)
  (org-link-abbrev-alist '(("Arxiv"         . "https://arxiv.org/abs/")
                           ("GitHub"        . "https://github.com/")
                           ("GitLab"        . "https://gitlab.com/")
                           ("Google"        . "https://google.com/search?q=")
                           ("Baidu"         . "https://baidu.com/s?wd=")
                           ("RFCs"          . "https://tools.ietf.org/html/")
                           ("LWN"           . "https://lwn.net/Articles/")
                           ("StackOverflow" . "https://stackoverflow.com/q/%s")
                           ("WG21"          . "https://wg21.link/")
                           ("Wikipedia"     . "https://en.wikipedia.org/wiki/")
                           ("YouTube"       . "https://youtube.com/watch?v=")
                           ("Zhihu"         . "https://zhihu.com/question/"))))
wowhxj commented 3 years ago

I tried to set org-appear-autolinks to t and solved the problem.

(use-package org-appear
  :ensure t
  :hook (org-mode . org-appear-mode)
  :custom
  (org-appear-autolinks t)
  )

test

I'm sorry that I didn't know that. Sorry for the inconvenience and thanks for the wonderful package. :-)

awth13 commented 3 years ago

@wowhxj, thank you for such a detailed response! I have to investigate this since, when org-appear-autolinks is nil, org-appear should not do anything with links. Your input is very useful.

I'm sorry that I didn't know that.

That's more of a call for me to improve the README :)