-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Action, target finder, target collector and exporter wishlist #95
Comments
We should also think about exporters run from non-mini buffers. One that has been suggested is that in an eww buffer, export could make a list of all the links. I'm not so sure about that, probably a But I'm sure there are some good opportunities for export from regular buffers I'm missing. Currently the only ones are kind of boring: dired buffers export their files, ibuffers export their buffers, |
Is there also a target finder wishlist? Or is the list already exhautive? |
The target finder list is not exhaustive at all! Should I make a separate issue for that or just broaden this one? |
I would use one wishlist as I have in consult. I think this works quite well as some kind of general discussion thread before the details are then discussed in a separate dedicated issue. |
Earlier when I mentioned eww links I was really talking about just collecting them and forgot to say what kind of buffer they should export to: maybe an |
OK, I've broadened this issue on your advice @minad. (I don't want the wishlist to also cover new commands, since in fact, I'm pretty skeptical about adding any new top-level commands to Embark at this point, except possibly the resume functionality, if we think it fits better in Embark.) |
Oh, I just remembered some actions for variables I often miss: |
Good news: now |
@oantolin This is amazing! I already have it mentioned here: https://github.com/minad/consult#integration-with-embark. Now I can remove the work in progress note 🥳 |
I added these for variables, and for commands I added |
I am just sharing this good idea for targeting video links: https://jao.io/blog/2021-01-09-embarking-videos.html. Natural complements are audio files and an action to yt-dl the target (audio could call Maybe this is something that can be of use. |
@oantolin the actions for variables and commands are not available here. I checked that the commit you referenced is applied, value of embark-keymap-alist set accordingly, etc. But when I act on something like [edit: |
org-mode classifiers and actions would also be great. Or would this be better for an external package? |
@sheijk The variable and command specific actions are currently only available from minibuffer commands for those categories. For example you get the command actions for candidates in M-x in recent Emacsen. If you use Marginalia, then you get the command actions in M-x even on older Emacsen. And again, with Marginalia, you get the variable actions from describe-variable, for example, or from customize-variable. The point is that, as you found, they are not supposed to work on symbols in regular buffers... yet! I've been thinking about refining the type. It would be much better once the multiple-targets stuff is finished #92, but for now I guess I could just pick an order: prefer command over variable if the symbol is both things. If Emacs were extended in Guile we wouldn't have these problems... 😛 |
Possibly a separate package would be better, I'm not sure. I mean Org does come with Emacs. But that can be decided later, the first thing is to decide what kinds of targets and actions would be useful in Org buffers. Did you have any thing in mind? For a target type to be really useful ideally it should have several associated actions. |
Separate package makes sense, or at least a separate elisp file to not require loading org-mode when embark gets used in other buffers. I've recently made a little transient based menu for org, I think most actions offered there would be good embark candidates. Some examples for actions would be:
|
I think your suggested org targets and actions are very good and that a separate |
You could create an embark-org.el file similar to consult-flymake.el in order to retain lazy loading but distribute it as part of embark melpa. |
@oantolin or maybe start it with the actions I already made. Are you looking for contributions (no promise!)? |
Thanks for pointing this out, @protesilaos. I wrote to jao to suggest a slightly different implementation which he wrote about, and I noticed he also wrote an async Spotify client using Consult and Marginalia! |
Yes, I have read them. My plan is to copy and adapt the video targeting part (never used spotify). More generally, I am excited to see what kind of solutions, tips and tricks the community comes up with for those packages. |
@oantolin @protesilaos Regarding the spotify client, it is exciting that they implemented a web access using the async api! I have some small experiments in the consult websearch branches as well, but they turned out to be not useful. |
I think the way Embark works on a regular buffer is too Elisp-centric. Hopefully most people spend most of their time in Emacs doing other things! For the purposes of On the other hand, I'm fine with the There could still be an |
@astoff I agree! But I guess thing-at-point is also elisp centric. Unfortunately elisp is somehow more first class in Emacs then the other major modes. But that is natural since you can see it as a whole programmable environment. |
@minad |
@oantolin Any comment on this from earlier in this thread? #95 (comment) |
@Zetagon Related to the current discussion - the aforementioned cmap package implements a set of useful org actions at point and a set of org target finders. You may want to take a look what exists there. |
I'm sorry @Zetagon, I haven't really had a chance to think about this. I do like the idea of having a target finder for org elements, but I think deciding what that target finder should return is a little tricky and requires contemplating what actions one would want. The two natural choices for it are to return the org element as a string, and to return a non-string (like the region target finder which just returns the symbol So you need to look at the likely actions and see how they actually work. In the org case most probably don't take the org-element as a string, but rather act on the thing at point. I also find it hard to decide whether the layered approach you took, with extra configuration variables for elements types and link types is really necessary. I haven't forgotten this, but haven't had time to think about it yet. |
Yeah that is completely understandable. I just didn't want it to drown in the discussion afterwards 🙂 Do take your time, I will just find something else to play with!
In my current implementation each element has its own target finder so what we return can depend on the target. For example the link target returns the link string, but that doesn't stop target finders for other elements to return, say a symbol or the parsed AST. Is there an advantage having the same return type for all elements I'm missing?
I think there is a greater benefit to having configuration variables for links than for element types at least, because users can add their own link types. |
In my opinion the second of those positions should target the symbol
An alternative would be to follow |
Oh, right! I fully agree with @astoff: |
Thanks for being understanding. We should probably create a separate issue for this, since as you say it could get drowned out here.
Oh, no, there's no advantage in all of them returning the same type, and that is not what I meant. I meant we should consider for each type what to return.
Yes, I agree. |
Agreed. Is this only for lisp modes or should this work in other programming modes that define sexps in some way (I think most do as expressions)? The mark, kill and indent actions would apply. Maybe not eval or expand though a send to interpreter might. |
Such a sexp target finder is quite simple, even simpler than the one I proposed before: (defun embark-target-sexp-at-point ()
"Target sexp at point."
(when (and (or (eq (char-after) ?\()
(eq (char-before) ?\)))
(thing-at-point 'sexp))
'(sexp <sexp>))) |
@hmelman It would be nice if it worked in other programming modes as well, but in my experience the definition of sexp often isn't good enough. Try |
Given the state of sexps in other modes, I think a minor tweak of @minad's target finder to use syntax class Oh, maybe syntax class |
@oantolin I am not sure about " since this may once again clash with other finders. file names? If we use only the parentheses we are at least safe that nothing bad happens. I also didn't consider other programming languages - I think these things just don't generalize well over other languages. |
But generally one could add additional target finders which are programming language specific. Or maybe it is even possible to do a bit better with tree sitter. However I think such actions should be maintained in third party packages. |
I think file names in strings should be safe. Given |
I have the following in a
I wanted to use the link text, "Maracaibo: The Uprising", in an external app (a browser search). I positioned point inside the word "Maracaibo" and could invoke I didn't think it would work but invoking I'd love if embark could act on this text as a target in Previously in this issue we talked about targets for links, but this is different as I don't want the url or the whole link, I think I want the text marked by a delimiter surrounding point which seems generally useful, but maybe someone has other ideas. |
What about new targets button and widget? We can use |
To act inside the delimiters of an s-expression, @hmelman, you could use this (which takes advantage of shiny new infrastructure I just added in f741dab):
The new thing added in that commit was the ability to add pairs of the form I'm not sure whether to add that to Embark (and wouldn't mind hearing some opinions), but if not, it can certainly go on the wiki. |
Looks a bit special to me, but we also have hash function actions so why not? I am not sure where to draw the line. ;) |
Oh, I should probably check the first and last character really are delimiters, because that's not always true of sexps in non-lisp prog modes. 🙄 |
Hmm, maybe this is a line I would draw. If an action gets too complicated it should not be added, since then there is no clear line on where to stop. Of course exceptions can be made for complex actions, which are considered important. While the hash actions are obscure they are only trivial wrappers. Additional wrapper actions for builtin functionality, which cannot be used otherwise in Embark, are nice to have. |
It would be great if EMBARK was made aware of I have code in my init.el to do that by looking at the overlay category ( |
@pcrama Embark already does. See Lines 766 to 771 in 592287b
|
Thanks and sorry for missing it. I still don't know how I initially got the impression it wasn't working but now it works for me. I don't know how to close this, unfortunately but from my point of view, this issue is resolved. |
I've started an embark-org package in this repo, which is one of things discussed long ago in this issue. I open a separate issue for discussion of what to add to embark-org, #502 |
BTW what is the preferable way to contribute my own finders/collectors? Recently I tinkered with embark and emacs-slack packages and added some actions on slack messages. Seems like it can be useful for someone, and I have the choice - to contribute it to the main embark repo or to go with separate package on my own. |
That's great @jumper047! Slack is out of scope for Embark, which only comes with key bindings and special actions for stuff that is built-in to Emacs. Integration with Slack would fit well in the Embark wiki, if it is small and simple, or your own package if it is more substantial. |
This is rather an issue for an inverse wishlist, this is more of a curation aspect - I think |
I think I might be missing many opportunities for target finders, target collectors and exporters. Let's list some here in this issue:
Target finders
url
.Target collectors
url
s. Or a new typeweblink
could be introduced which has both a url and a title.Enhancements to existing collectors:
Exporters
Done.bookmark
should export to bookmark-bmenu-mode.line
should export to occur-mode.line
was renamedconsult-location
and it does export to occur mode now!url
orweblink
if introduced could export to eww-bookmark-mode, which seems like a reasonable mode for a list of links even if they are not actually bookmarks. (I'm not sure about this.)Actions
url
could use a download action (I'm thinking I'd only use this outside of eww buffers).kill-ring
could use a "remove from kill-ring" action.The text was updated successfully, but these errors were encountered: