My today's Emacs finding is the amazing perspective.el which someone mentioned on Liberachat #emacs IRC. It solves what I was trying by beframe, but I never ever managed to get it in a working state, but perspective.el works nicely with everything out-of-the-box and also with one simple hook also plays nicely with ibuffer.el. Give it a try especially if you like me work on multiple projects at the same time:
@Mehrad I clicked through to see what it does. My immediate question is, how is it better than starting another Emacs?
@sigue
The answer is simple and has three folds:
1. It improves life for those who use Emacs daemon/server (imho the best way to use Emacs)
2. Helps to be selective and pass buffer from one perspective to another
3. Opening another Emacs instance means unnecessary memory consumption, unnecessary loading time, etc.
@sigue: Like the README mentions, it’s trivial to pass buffers between Perspectives; it’s impossible to do so between Emacs instances. I need it from time to time, and I can’t imagine working without that.
@sigue: Also, assuming you weren’t talking about opening two different Emacs instances, it can be useful to have everything running on the same Emacs instance—any quick-and-dirty Emacs Lisp you write, keyboard macros you make, registers, et cetera will be available across all your Perspectives (but also all frames if you use the editing server).
@Mehrad: The shine wears off quick. Perspectives is buggy and some key things like Winner-mode don’t work. What’s infuriating is that in the whole class of packages like it implementing workspaces for Emacs, it’s the only one that lets the workspaces have their own buffer lists (all the others seem to only track windows), so it’s irreplaceable.
@soldiers_dream_grass
It is very irresponsible.
But is the compatibility issues with winner more related to perspective or to winner mode?
I myself don't use winner-mode much, and so far I have had no major issues with perspective. What other issues have you faced?
@Mehrad: Winner-mode doesn’t work, Winner-mode keeps one ‘winner-ring’ across all your Perspectives—which is a recipe for destroying a Perspective’s window configuration because every Perspective has its own unique window configuration. It’s not Winner-mode’s fault; Perspective’s failed to patch Winner-mode to work, for years now. For me, Winner’s been a super convenient way to manage windows in Emacs, but unfortunately I’ve had to drop it since Perspectives is more useful to me.
@Mehrad: The other big problem, that I can remember off the top of my head, is also related to window management—there are no ‘previous-’ and ‘next-window’ commands in Perspectives. The default Emacs ones don’t work reliably because, just like Winner, they keep one ring across all your Perspectives and it can mess up a Perspective’s window configuration. Perspectives’ maintainers weren’t interested in writing Perspective-versions of those commands—so long until I can write good enough Emacs Lisp
@Mehrad: Saving Perspectives across Emacs restarts also doesn’t work for me, but I don’t think I should blame them for that bug because EXWM might be the one causing it.
@Mehrad: Here’s Perspectives’ current maintainer saying they wished an alternative would have feature-parity with Perspective so they could switch over to it and let Perspectives’ bogged down codebase go: https://github.com/alphapapa/activities.el/discussions/61#discussioncomment-8966471
@soldiers_dream_grass
Interesting read, although in my head (and very limited experience with perspective.el) the activities.el does a completely different thing as it "suspends" the activity and let you spawn/unpause other activities. If my understanding us correct, then perspective.el has a very great advantage as a person can open multiple projects side-by-side without them leaking buffers to each other. Do you have any experience with activities.el?
@Mehrad: They’re both trying to do the same thing, except Perspectives keeps track of all buffers you’ve ever spawned in a ‘perspective’. Activities only keeps tracks of windows, i.e. buffers you have open on the screen. It has its own jargon for the commands: “suspending” an ‘activity’, I think, is the same as switching away from a Perspective. But I’ve not used it yet. I’m really waiting for all buffers, visible or not, to be tracked in ‘activities’
@Mehrad: Forgive me, but you can’t open (buffers from) two Perspectives side-to-side, though? Unless you’re talking about ‘merging’ two Perspectives, or global buffers.
@soldiers_dream_grass
I haven't tried it yet, but in beframe.el there is a way to transfer a buffer to another beframe. So I thought that the perspective.el already have something similar.
Anyways, regarding the window situation, perhaps a simple (advice ...) can be used to populate the winner related variables with values from a dotted paired list. It shouldn't be that hard to write two functions to be used for advising winner
> … a way to transfer a buffer to another [Perspective].
That can be done, yes; I misunderstood what you meant.
@Mehrad: There’s an issue on Perspectives’ GitHub about the Winner incompatibility, the maintainer says that they’re not sure that ‘winner-ring’ can be advised to be compatible with Perspectives as it is not defined with a ‘defun’ (or something like that).