ranger.el icon indicating copy to clipboard operation
ranger.el copied to clipboard

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

Open ztlevi opened this issue 6 years ago • 6 comments

Description

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

Reproduction

  • Start Emacs

  • split window image|591x500

  • open the same file using dired or ranger image|591x500

  • split windows are merged image|591x500

Observed behaviour

split windows are mereged

Expected behaviour

Do not merge split windows

ztlevi avatar Oct 02 '18 00:10 ztlevi

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

ztlevi avatar Oct 02 '18 19:10 ztlevi

This is an issue only in deer-mode right?

punassuming avatar Feb 02 '19 04:02 punassuming

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

ztlevi avatar Feb 02 '19 20:02 ztlevi

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?

punassuming avatar Feb 02 '19 21:02 punassuming

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.

ztlevi avatar Feb 03 '19 02:02 ztlevi

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

thanhvg avatar Oct 07 '19 17:10 thanhvg