-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Highlight the chosen symbol/entity ala isearch-forward-symbol-at-point #269
Comments
That's an interesting idea but there are some subtleties. If you use Embark outside of the minibuffer, it displays what you will act on in the echo area. In part this is because it was easier but also because the target finders are under no obligation to return a portion of buffer text! Even pretty standard ones do not, for example Embark uses ffap for file names, and this returns full paths, not just whatever is found in the buffer. If you use I guess most of the target finders that come with Embark do provide targets that are at least based on a portion of the buffer text, and this portion could be highlighted. But if we do this it could be slightly confusing that what is acted on does not exactly match what is highlighted. |
Interesting thanks. I actually hadn't realized embark gives a report in the mini buffer of what it will act on! From the start I was using the recommended I actually opened a related consult issue to get it to care about the symbol-at-point highlighted selection if that's set. It's an underused but cool native Emacs feature. Please feel free to close. Thanks for embark! Edit: I would certainly enjoy the "matched portion" highlight idea you mention though, and personally wouldn't find it confusing at all as it is the "original source". |
Ah! Which-key strikes again. I wonder if there is anywhere to put the target in which-key's popup. That would probably be the best solution. |
Try this: (setq embark-action-indicator
(lambda (map &optional target)
(which-key--show-keymap (format "Act on '%s'" target)
map nil nil 'no-paging)
#'which-key--hide-popup-ignore-command)) I think it looks decent. |
I think I'm going to change the which-key recommendation to this: (defun embark-which-key-indicator (fmt)
(lambda (map &optional target)
(which-key--show-keymap (format fmt target) map nil nil 'no-paging)
#'which-key--hide-popup-ignore-command))
(setq embark-action-indicator (embark-which-key-indicator "Act on '%s'")
embark-become-indicator (embark-which-key-indicator "Become")) |
The last works quite well. Thanks. |
@oantolin Why not implement this? The target finders could return both a string and optional bounds. Not worth the complication? |
Oh, I do think it is a good idea and was planning on doing it. |
The command
isearch-forward-symbol-at-point
is in many ways like a tiny baby embark. It looks for a symbol at point, and sets you up for further action on it (search or occur for example). One of the features it has that I'm really missing with embark: it highlights the matched symbol temporarily, showing you what it will be taking action on. Here it is in action:Would be great if embark stole this idea!
The text was updated successfully, but these errors were encountered: