punassuming / ranger.el

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

Ranger open same file existing in other windows will overwrite the existing window #190

Open ztlevi opened 5 years ago

ztlevi commented 5 years ago

Description

If Emacs with split windows,open the same file existing in other windows will overwrite the exsiting window.

Reproduction

Observed behaviour

split windows are mereged

Expected behaviour

Do not merge split windows

ztlevi commented 5 years ago

Found the solution, overwriting the ranger-disable function. We probly should add a custom variable for users to select the behavior, e.g. ranger-merge-opened-buffers-if-existing-in-windows.

(defun ranger-disable ()
    "Interactively disable ranger-mode."
    (interactive)
    (ranger-revert))
punassuming commented 5 years ago

This is an issue only in deer-mode right?

ztlevi commented 5 years ago

Yes, because we probly will not open two ranger buffers at the same time

punassuming commented 5 years ago

It happens and is a use case I need to figure out (two ranger frames). Just to clarify, would you like opening the file just focus the existing buffer window and not close deer?

ztlevi commented 5 years ago

I do like open two deer buffers at the same time. For example, I can do copy pasting files between these two deer buffers.

I've noticed deer can create multiple tabs. But I prefer open multiple deer buffers.

thanhvg commented 4 years ago

I have another issue with current behavior of deer-mode when opening the same file. After the split window is deleted because ranger is opening the same file, do a deer on the buffer to go to deer-mode will trigger a warning:

file changed on disk; really edit the buffer? (y, n, r or C-h)

The buffer is not changed at all. I guess ranger misread the buffer state in this case. And there is no way to get out of this. I find @ztlevi's solution fixed my problem. I am using Spacemacs so it could be Spacemacs's issue, but I doubt it.

Thanks