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

Feature: replace existing URLs in Org document #38

Open
nvgeele opened this issue Aug 6, 2020 · 9 comments
Open

Feature: replace existing URLs in Org document #38

nvgeele opened this issue Aug 6, 2020 · 9 comments

Comments

@nvgeele
Copy link

nvgeele commented Aug 6, 2020

First of all, thanks for this package. It's making my notes, which often include a lot of (lists of) links to articles and so on, a lot more readable.

I have quite a few notes which already include a number of plain URLs or URLs with a short version of the page title. To make these notes more readable I would like to automatically change their description to the title of the linked page. Instead of yanking each URL and calling org-web-tools-insert-link-for-url, it would be handy to have another command which looks at the URL under the cursor, and replaces it with a link that has the title of the page as its description. If the link already has a description it could simply replace the existing description.

@alphapapa
Copy link
Owner

Hi Nils,

Apologies for overlooking this issue.

That could be a useful feature. It should be a simple command to write. Would you be willing to submit a PR?

Thanks for the suggestion.

@geekodour
Copy link

geekodour commented Feb 1, 2023

two years late but I found a need for this today. Probably a terrible way to do it, but works for me :)

(defun org-web-tools-insert-link-on-point ()
  (interactive)
  (replace-string (thing-at-point 'url t) (org-web-tools--org-link-for-url (thing-at-point 'url t))))

Another nice feature related to this would be to parse selected text for url and convert them to org-links in batch. I am not sure how to do that in a non-blocking manner atm. any ideas around that?

@alphapapa
Copy link
Owner

@geekodour Well, using replace-string is unidiomatic Elisp, but if it works... :)

Another nice feature related to this would be to parse selected text for url and convert them to org-links in batch. I am not sure how to do that in a non-blocking manner atm. any ideas around that?

Doing it asynchronously would require care to account for the case in which the buffer's contents might have changed before the command finishes. As well, you'd need an asynchronous version of org-web-tools--org-link-for-url (that part would be easy). But it could certainly be done.

@geekodour

This comment was marked as off-topic.

@alphapapa

This comment was marked as off-topic.

@geekodour

This comment was marked as off-topic.

@geekodour

This comment was marked as off-topic.

@geekodour

This comment was marked as off-topic.

@alphapapa

This comment was marked as off-topic.

@alphapapa alphapapa added this to the Future milestone Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants