punassuming / ranger.el

Bringing the goodness of ranger to dired!
699 stars 52 forks source link

Ranger conflicts with emacs-purpose and golden-ratio #148

Open deb0ch opened 7 years ago

deb0ch commented 7 years ago

Ranger does not work properly when emacs-purpose is activated: the preview does not appear on the right where it is supposed to, but on the parent directory's window instead.

This is somewhat linked to another conflict between Ranger and golden-ratio (I actually discovered the emacs-purpose conflict while debugging this one):

when golden-ratio is activated, it messes up Ranger's windows badly. Happily, this is fixed by adding ranger-mode to the golden-ratio-exclude-modes list. The only thing is, if purpose-mode is activated as well, the windows are messed up again. I think it is because purpose makes a non-ranger-mode preview window active for a brief instant and golden-ratio resizes it.

One solution that I could imagine would be having two hooks: one when activating Ranger and one when leaving it, that would temporarily disable any window-managing minor-mode during a Ranger session and restore the previous state afterward. I think you already have the first hook but didn't see the second one in the code.

This way we could also easily deal with any other window-managing minor-mode that would conflict with Ranger in the future.

As you may know, emacs-purpose is currently integrated to Spacemacs' develop branch.

Don't hesitate to request screenshots if I wasn't clear enough ! :smile_cat:

deb0ch commented 7 years ago

Cc-ing @bmag just in case.

bmag commented 7 years ago

Below is what I get when I invoke ranger (via SPC a r). Isn't this how it's supposed to be? image

Anyway, if it's indeed an integration issue between window-purpose and ranger, this sort of problem is usually solved by configuring window-purpose (and sometimes fixing the window-creation process of the other package).

deb0ch commented 7 years ago

Well that's strange, I just tried again and I actually don't reproduce 100% of the time (but still often enough) 🤔

It just happend sometimes, more often when switching from a directory preview to a regular file preview or the other way around.

Strange.

bmag commented 7 years ago

I actually don't reproduce 100% of the time

It could depend on what buffers are visible when you call ranger and also depend on how you invoke ranger, so details about window layout before invoking ranger (including window purposes, can be obtained via M-: (purpose-window-purpose) if not visible in the mode-line), how you invoke ranger, and window layout afterwards (including purposes) is needed. (if it's a window-purpose issue)