Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with with org-link-descriptive = nil #4

Closed
andersjohansson opened this issue Dec 9, 2020 · 10 comments
Closed

Issue with with org-link-descriptive = nil #4

andersjohansson opened this issue Dec 9, 2020 · 10 comments
Labels

Comments

@andersjohansson
Copy link
Contributor

Hi, and thanks for this brilliant work. I notice a great speed-up!

However I realized that this interferes with some of the standard behaviour of org links.

A minimal test case:

* Org link test
[[https://example.com][A link to a site]]

When org-link-descriptive is nil (it can be toggled with org-toggle-link-display, which removes org-link from the invisibility spec), the link is still visible when folding the headline.

Tested with emacs -Q -L ./lisp -l org as well
I am on emacs built from the native-comp branch:
GNU Emacs 28.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.17.3) of 2020-11-19

Normally, I have org-link-descriptive = t, and wouldn’t have noticed this if it wasn’t for a custom link type that I use, where I previously were able to use a custom :activate-func to display a selected part of the link (outer brackets + description). This doesn’t work either.

@yantar92
Copy link
Owner

yantar92 commented Dec 9, 2020

I confirm. ol.el uses invisible text property to hide/unhide links, which interferes with implementation details of org-fold. I will need to rewrite link fontification to use the new folding library.

@yantar92 yantar92 added the bug label Dec 9, 2020
@andersjohansson
Copy link
Contributor Author

Ok! Note that this is both in ol.el and in the definition of org-mode in org.el:4684, and also in org-activate-links (org.el:5062). org-link-parameters supports using a custom value for the invisible text-property (added in org-activate-links), and recommends to use full (which is never added to buffer-invisibility-spec) if the full link text should be displayed for a certain link type (see docstring of org-link-parameters). I gather this also interferes with the org-fold mechanisms.

@andersjohansson
Copy link
Contributor Author

I’m of course glad to test any updates! (I could also, hypothetically, contribute code (have FSF copyright assignment), although my understanding of how org-fold works is still limited)

@yantar92
Copy link
Owner

Can you test now? Should be fixed.

org-link-parameters supports using a custom value for the invisible text-property

Thanks. It should be correctly handled by org-fold.

I could also, hypothetically, contribute code (have FSF copyright assignment),

I certainly don't mind someone who is actually a programmer helping with this :)

... although my understanding of how org-fold works is still limited

Feel free to ask anything you want to know. The very general idea is described in https://github.com/yantar92/org#org-modeorg-fold-branch. Also, I tried to explain the logic as much as possible in comments within https://github.com/yantar92/org/blob/feature/org-fold/lisp/org-fold.el

yantar92 pushed a commit that referenced this issue Dec 10, 2020
yantar92 pushed a commit that referenced this issue Dec 10, 2020
@andersjohansson
Copy link
Contributor Author

Yes, in my small testing everything seems to work as expected! Loading org, toggling with org-link-display and also my custom displayed links (after adapting to using org-fold).

For reference, this is what I am using now for displaying citation links (I am using zotxt, for generating references from Zotero, although I have hope for better integration of citations into org (wip-cite-new branch)).

;; Special fontification, I often manipulate rows of references,
;; and then it’s useful to display the outer brackets, for easy
;; killing and yanking.

(org-link-set-parameters "zotero"
                         :display 'full ; invisibility is handled in the activate function
                         :activate-func #'aj/org-zotxt-activate)


(defun aj/org-zotxt-activate (start end path bracketp)
  "Add text properties to display zotxt citation links in a good way"
  ;; it’s always 36 chars, I think: "[[zotero://select/items/1_EEIVB8QC]["
  (org-fold-region (1+ start) (+ start 36) t 'org-link)
  (org-fold-region (1- end) (- end 2) t 'org-link))

As for being an actual programmer, even if I have taken a few programming courses, I am also just an academic using Emacs for writing, mail and planning (and some research), and fiddling with elisp 😄

@yantar92
Copy link
Owner

yantar92 commented Dec 10, 2020 via email

@andersjohansson
Copy link
Contributor Author

Thank you!

Interesting solution with the scraper! Yes, everything in emacs... Zotero helps me interact with others from time to time (I can export to valid zotero-marks in odt... via some steps). Well.

@yantar92
Copy link
Owner

Yes, everything in emacs...

Unified interface :)

I can export to valid zotero-marks in odt

What is zotero-marks?

@andersjohansson
Copy link
Contributor Author

Actually I export via generating these kinds of marks: https://zotero-odf-scan.github.io/zotero-odf-scan/, which can then be converted to "active" zotero citations in odt. My sort of messy code for this is here: https://gitlab.com/andersjohansson/emacs-zotxt-extra

The benefit is that I can get correct "active" citations when exporting both to odt and latex. But it is still a bit too much of a hacked together solution.

@yantar92
Copy link
Owner

Actually I export via generating these kinds of marks

Thanks. I see what it means now. I think something along that lines is natively supported by org-ref (probably, limited to pdf export).

yantar92 pushed a commit that referenced this issue Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants