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

edit of link before inserting, something like org-insert-link #99

Open
notuntoward opened this issue Dec 17, 2017 · 3 comments
Open

edit of link before inserting, something like org-insert-link #99

notuntoward opened this issue Dec 17, 2017 · 3 comments

Comments

@notuntoward
Copy link

I use org-cliplink everyday, but I often wish that it had one enhancement: a way to edit the link description before it's inserted into the org buffer.

The link descriptions org-cliplink derives from the URL are sometimes perfectly usable, but often, I have to edit them because they include odd information (for this page, the description is "Sign in to GitHub..."), or information I don't want to see, for example, the name of the website in addition to the web page article.

Of course, I could edit the the link once it's in the org-buffer, but then I have to be careful about certain keys, for example, C-k to delete the tail of the description (it will mess up the link syntax by deleting the closing ']]').

So, I'd like an option allowing the link to be edited in the minibuffer, the same way as links are editable byorg-insert-link. At least the description, but possibly the URL too, since I'm already hardwired to handle link insertion this way.

@rexim
Copy link
Owner

rexim commented Dec 17, 2017

@notuntoward thanks for filing this issue! Did you know that org-insert-link also edits the links? :) Just put your cursor over an org-mode links and invoke org-insert-link again. It will prompt you to modify the link and the description. That way you can safely edit your links without breaking the org-mode syntax.

As for the feature you are proposing, it sounds interesting, but I'm strongly against implementing it by modifying the default behaviour of org-cliplink function. org-cliplink function will always just insert the link, because I believe at this point everybody who uses org-cliplink (including me) expects it to behave like that. I also value UX backward compatibility. :)

I see two options here:

  • Make a separate command. Something like org-cliplink-edit-description. We already did that for org-cliplink-capture (this is a function that behaves just like org-cliplink but integrates with org-capture better use org-cliplink in org-mode capture #74)
  • Alter the default org-cliplink behaviour if a prefix command provided. For example:
    • M-x org-cliplink just inserts the links as usual
    • C-u M-x org-cliplink prompts the user to modify the description before inserting the link

I personally like the idea with the prefix command. Please, let me know what you think.

@notuntoward
Copy link
Author

I didn't know that org-insert-link could also edit, but now I do -- thanks for the tip!

I slightly favor the option for org-cliplink-edit-description because I never know ahead of time whether or not I'll want to edit a link. With straight-up org-insert-link behavior, keeping the link as is would be pretty easy and already semi-automatic --two hits of the return key. Or, it could be only one return if there's no opportunity to edit the URL (maybe additional URL editing could be the org-cliplink-edit-description prefix command).

But I'd be happy with either or both options.

@rexim
Copy link
Owner

rexim commented Dec 19, 2017

@notuntoward got it, thanks! I will try to do something once I have spare time.

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

2 participants