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

Links with descriptions not linkified in org-ql-view #282

Closed
jakebox opened this issue Jun 4, 2022 · 8 comments
Closed

Links with descriptions not linkified in org-ql-view #282

jakebox opened this issue Jun 4, 2022 · 8 comments
Assignees
Labels
Milestone

Comments

@jakebox
Copy link

jakebox commented Jun 4, 2022

Situation: I have a large org file with a number of headlines tagged :article: (things I might want to read). I like to get all of them at once with a simple org-ql query. I was writing a function to export the buffer so I can have a single file of tags, but it turns out that the links do not transfer because I use the orgmode link syntax in the heading (the [[link][description]]).

Is it possible to have the links be transferred to the org-ql result? Or, at least, have them be highlighted with the org-link face (like links without descriptions are)?

Thank you! Hope this explanation is clear.

@alphapapa
Copy link
Owner

alphapapa commented Jun 8, 2022

Hi Jake,

I'm sorry, but I will need you to be even more specific before I can help you.

You may also consider that this may be a case of the "XY problem," and that it would probably be helpful if you sought help on, e.g. https://old.reddit.com/r/emacs+orgmode, where many other people can offer help, and others can benefit from the answers. This tracker is best reserved for bug reports and feature requests (and I think there isn't either here, since AFAIK org-ql already does what you ask for).

@jakebox
Copy link
Author

jakebox commented Jun 14, 2022

Sure. Let's see if I can better explain with some screenshots.

This is my org-agenda, built from the following two headlines:

*** TODO [[https://github.com/alphapapa/org-ql/issues/282][A headline with a link]]
*** TODO A headline with an exposed link: https://github.com/alphapapa/org-ql/issues/282

Screen Shot 2022-06-14 at 10 15 11 AM

Both of the items are highlighted in the org-link face.

If I do an org-ql query on the same file to match all TODOs (todo "TODO") I get this:

Screen Shot 2022-06-14 at 10 17 21 AM

The first item, a link with a description, has face default — that is the issue I am attempting to report/feature I am requesting. I think that the headline, when queried with org-ql, should have the org-link face like it does when viewed through org-agenda.

Hope that makes sense. Thanks!

@alphapapa alphapapa changed the title Links in org-ql Links with descriptions not linkified in org-ql-view Jun 15, 2022
@alphapapa alphapapa self-assigned this Jun 15, 2022
@alphapapa alphapapa added this to the 0.7 milestone Jun 15, 2022
@alphapapa
Copy link
Owner

Now I understand. That will probably be a simple fix. I'll plan to fix it in the 0.7 release, but that may not be for a while, as my time to work on org-ql lately is limited. Thanks for reporting it.

@alphapapa alphapapa added the bug label Jun 15, 2022
@jakebox
Copy link
Author

jakebox commented Jun 16, 2022

Cool. Thanks! I'll leave the issue open for you to close then.

@alphapapa
Copy link
Owner

@jakebox Thanks for your patience. Looking at this issue again, I'm not sure what the correct fix is, because I don't fully understand how, where, and when Org is "prettifying" links.

I noticed that when I comment out this call to org-link-display-format in org-ql-view--format-element:

(org-link-display-format it)))
...it seems to produce the intended appearance. This is on Emacs 28 with Org 9.5.2.

Could you please test the same thing and see if it fixes it for you? i.e. do:

  1. C-h f org-ql-view--format-element RET and click the link to go to the source code.
  2. Comment out the call to org-link-display-format like so:
           (title (--> (org-ql-view--add-faces element)
                       (org-element-property :raw-value it)
                       ;; (org-link-display-format it)
                       ))
  1. C-M-x to evaluate the defun.
  2. Do an org-ql-search containing links that weren't displayed correctly before, and see if they have the correct appearance now.

@alphapapa alphapapa modified the milestones: 0.7, 0.8 Mar 10, 2023
@jakebox
Copy link
Author

jakebox commented Mar 10, 2023

Yes, that works for me! I'm on 28.2 with Org version 9.5.5.

Appearance is correct. Interesting how the link still exists (i.e. I can open it regardless of the formatting with C-c C-o).

Thanks for coming back to this.

@alphapapa alphapapa modified the milestones: 0.8, 0.8.1 Dec 16, 2023
@alphapapa
Copy link
Owner

@jakebox Thank you for your patience, and for reporting this. It should finally be fixed.

I still don't fully understand how or why this fixes it, but since it appears to work fine, I'm not going to spend the time to dig into Org's internals to find out why. If it turns out that this breaks something else, we'll revisit and fix it.

I released this fix in v0.8.1 and on master.

@jakebox
Copy link
Author

jakebox commented Jan 4, 2024

Wonderful, thank you for your diligence! Glad to see this fixed.

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