Git Product home page Git Product logo

Comments (7)

zenspider avatar zenspider commented on September 13, 2024

I don't use helm, but patches are welcome.

Since nobody seems to be clamoring for this, it might be considered out of scope.

from perspective-el.

gcv avatar gcv commented on September 13, 2024

Let's keep this one open for now. I actually ran into a situation yesterday when I wanted this feature and remembered this ticket.

from perspective-el.

gcv avatar gcv commented on September 13, 2024

@alphapapa: I'm looking into this, and... I guess I'm not as proficient with Helm as I thought (which wasn't very).

How do I select a series of files in Helm and feed them to an arbitrary command, e.g., persp-add-buffer? I usually just end up in Helm's projectile integration browser, and I know how to mark several files, but hitting Tab gives me a canned list of commands. I don't see a way to invoke a command on the selection. I read on the wiki something about making eshell aliases, but though I can pick an alias somewhere in the command tree, it doesn't seem to do anything at all (or maybe I didn't define one correctly).

from perspective-el.

gcv avatar gcv commented on September 13, 2024

With commit 0b693bd, helm-buffers-list now lists buffers in all perspectives when called with a prefix argument. It now has actions to add to the current perspective, and to remove buffers from the current perspective. It supports both actions with multiple marked buffers. If anyone has ideas about how to make Helm work directly from persp-add-buffer, let me know (either reopen this ticket or make a new one).

from perspective-el.

meliache avatar meliache commented on September 13, 2024

I'd like to be able to add multiple buffers at once without helm, just using the generic completing-read-multiple (which I use via selectrum).

I was thinking about creating a new issue, but searched the closed issues first and found this. The issue title doesn't mention helm explicitly, so I think a more generic solution could be discussed.

Now that I think about it, it would be also useful to batch-remove buffers from a perspective. I haven't created my own completing-read-multiple-functions, but whenever packages use that out of the box (e.g. for tagging), I found it incredibly useful.

Instead of via completing-read-multiple, it is also convenient to add/remove marked buffers from ibuffer. Here's what I came up with:

  (defun meliache/persp-ibuffer-remove-marked-buffers ()
    (interactive)
    (dolist (buffer (ibuffer-get-marked-buffers))
      (persp-remove-buffer buffer)))

  (defun meliache/persp-ibuffer-add-marked-buffers ()
    (interactive)
    (dolist (buffer (ibuffer-get-marked-buffers))
      (persp-add-buffer buffer)))

It might be useful to have some similar functions built in or at least documented somewhere.

from perspective-el.

gcv avatar gcv commented on September 13, 2024

Re: completing-read-multiple: I like that. I think persp-add-buffer and persp-remove-buffer can be modified to use completing-read-multiple. There might be minor complications with persp-interactive-completion-function.

Re: ibuffer. Your functions look fine, I can add them (feel free to open a PR [and don’t forget the needed declare-function calls], or I’ll just do it later). What’s the right way to integrate them with ibuffer? Is there a keymap they should be added to? Or just let users run them with M-x?

from perspective-el.

meliache avatar meliache commented on September 13, 2024

Re: ibuffer. Thanks, I might do the PR. I came up with the functions rather on the fly, while writing the comment I wanted to write that such functions would be useful, but then I thought this should be easy to do myself if there's a way to get the marked buffers and it was. I didn't think much about keymaps yet, after all we don't have a special "persp-ibuffer" mode, so the only way would be to add keybindings to ibuffer-mode-map (or create a new keymap). So far I just used the commands interactively via M-x. Maybe it would be useful to shadow the keybindings for persp-add-buffer and persp-remove-buffer with their ibuffer-versions while in ibuffer-mode, though this than makes it difficult to add/remove the ibuffer-buffer, so I'm not sure if that's good UX design.

When I run persp-ibuffer and then meliache/persp-ibuffer-remove-marked-buffers, this doesn't remove the removed buffers from the ibuffer view, so sometimes I call persp-ibuffer again to update the view. It would be nice to have this update done automatically, though that shouldn't be done when run withing a normal ibuffer showing all perspectives.

Also I didn't think yet whether I should unmark the files after executing one of the above commands.

I think we could continue such discussions in the PR.

from perspective-el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.