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 Request: Select links with ivy rather than avy #38

Open
rgrinberg opened this issue Apr 25, 2020 · 11 comments
Open

Feature Request: Select links with ivy rather than avy #38

rgrinberg opened this issue Apr 25, 2020 · 11 comments

Comments

@rgrinberg
Copy link

Sometimes, it's more convenient to find the link/button by entering a substring rather than entering an avy code. It also makes it possible to select elements that are off the screen this way. Would it be possible something to have something like akin to counsel-link-hint?

@noctuid
Copy link
Owner

noctuid commented Apr 25, 2020

Yes, I've mentioned wanting to add support for this in a comment in #14. It should be pretty easy. Run link-hint--collect to get candidates and then pass them to completing-read (so it would work with other completion frameworks) and then call the action on them. I'll see if it's something I can do quickly next week.

It might be slow if you wanted get all the links in an entire buffer (if big) though.

noctuid added a commit that referenced this issue Apr 29, 2020
- Add a generic selection helper for which avy and completing-read link
  selectors are built on top of
- Allow customizing completing-read functions so different ones can be used for
  selecting an action, selecting one link, and selecting multiple links
- Allow various ways of selecting actions after running a command (before with
  completing-read, during with avy-dispatch-alist or ivy actions, or after with
  completing-read); see updated readme

Fixes #38 and #14.

Also
- Remove useless :group from defcustoms
- Rename type valid and valid types functions do better clarify their purposes
- Fix typo for markdown links (:parser -> :parse)
@noctuid
Copy link
Owner

noctuid commented Apr 29, 2020

I had some time to work on this yesterday evening and also implemented #14. See the completing-read branch if you want to try it and give feedback. It is actually instant with very large buffers for me, but I don't have files with a ton of links (didn't test anything with more than 150 links).

Note to self on what is left to do before merging:

  • Test everything to make sure nothing broke
  • Maybe read list of strings instead of symbols for actions
  • Test all-windows-alt; use with completing-read? remove corresponding todos from link-hint.el
  • Ensure every entry to completing-read is unique (add window and position in some visually pleasing... or invisible way); remove corresponding todo
  • Maybe optionally set this-command in `link-hint-completing-select (will this cause issues?)
  • Add action for jumping to a link position
  • Add example for embark; specify metadata type for urls
  • Add categories for some link types (see completion-metadata)

@rgrinberg
Copy link
Author

Looking good. How would one write an ivy action that would navigate to the point where the link is?

Also, do you think it makes sense to add better integration with ivy if ivy is loaded? While it's nice to make things generic, the majority of emacs will not customize things and I feel like it's better to make things as nice as possible out of the box.

@noctuid
Copy link
Owner

noctuid commented Apr 30, 2020

Right now, you could set link-hint-restore to nil (for the duration of a command) and use :copy to copy and jump to a link. I'll have to add a dedicated action or way to just jump.

Also, do you think it makes sense to add better integration with ivy if ivy is loaded?

Is there some ivy-specific feature you want? If ivy-mode is on, it will use ivy.

@rgrinberg
Copy link
Author

I'll have to add a dedicated action or way to just jump.

A dedicated action would be nice.

Is there some ivy-specific feature you want? If ivy-mode is on, it will use ivy.

I was thinking of adding some fancier previewing using ivy-rich. I'll experiment a little more and report back.

@noctuid noctuid pinned this issue Apr 7, 2021
@mohkale mohkale mentioned this issue Nov 19, 2021
20 tasks
@minad
Copy link

minad commented Nov 20, 2021

@noctuid Do you plan to add the completing-read interface to link-hint? It is quite useful also in combination with embark-collect.

@noctuid
Copy link
Owner

noctuid commented Nov 22, 2021

After finding ffap-menu, I wasn't how sure how useful this is since that handles a lot of links, and in some buffers you can get a lot of garbage with the link hint version (not all links/buttons have useful/searchable text). That is a fixable issue though. Most of the work is already done, so if someone finds it useful, I'd be happy to update and merge the branch. I'd probably like someone to give more feedback on it though because I don't think I will often use it myself.

@minad
Copy link

minad commented Nov 22, 2021

Interesting, I was not aware of ffap-menu. But a link-hint completing-read interface should be more general? cc @oantolin

@nicolas-graves
Copy link

After finding about ffap-menu, I was wondering if functionalities of link-hintcan actually be reproduced with completing-read and ffap regex url handling functionalities alone (without avy-like functionality then, and with an extensive ffap-alist). Do you see something hindering it ? I might consider writing such a ffap-alist configuration. @minad @oantolin @noctuid

@noctuid
Copy link
Owner

noctuid commented Nov 14, 2022

Not sure if I understand exactly what functionality you want, but a large number of link-hint links/buttons are found using text or overlay properties, not regexp, so you couldn't replicate link-hint with an alternate completing-read interface with regexp alone.

@nicolas-graves
Copy link

Sorry, I wasn't clear, I've read again the help for the variable ffap-alist. It works with proper functions using either current major modes or regexp. I'm not familiar enough with text or overlay properties, but if they fit in a function used when in a major-mode, it might be reproducible. I will take a look at it next month.

@noctuid noctuid unpinned this issue Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants