Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ranger-show-literal forgets to close all it's windows #216

Open
Syncriix opened this issue Feb 13, 2020 · 0 comments
Open

ranger-show-literal forgets to close all it's windows #216

Syncriix opened this issue Feb 13, 2020 · 0 comments

Comments

@Syncriix
Copy link

When I enable (setq ranger-show-literal nil) and browse to a rendered org-file ranger fails to close all windows. The left most window always stays opened and I have to C-x o q to close it.

I tried all combinations of (setq ranger-cleanup-on-disable t) and (setq ranger-cleanup-eagerly t)
They did not help, I always get apply: Wrong type argument: window-live-p, #<window 3>

Debug of it:

Debugger entered--Lisp error: (wrong-type-argument window-valid-p #<window 3>)
  window-frame(#<window 3>)
  ad-Advice-set-window-buffer(#<subr set-window-buffer> #<window 3> #<buffer configmain.org>)
  apply(ad-Advice-set-window-buffer #<subr set-window-buffer> (#<window 3> #<buffer configmain.org>))
  set-window-buffer(#<window 3> #<buffer configmain.org>)
  window--display-buffer(#<buffer configmain.org> #<window 3> reuse ((inhibit-same-window)))
  display-buffer-same-window(#<buffer configmain.org> ((inhibit-same-window)))
  display-buffer(#<buffer configmain.org> (display-buffer-same-window (inhibit-same-window)))
  #f(compiled-function (buffer-or-name &optional action norecord) "Display buffer specified by BUFFER-OR-NAME and select its window.\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf it is a string not naming an existent buffer, create a buffer\nwith that name.  If BUFFER-OR-NAME is nil, choose some other\nbuffer.  In either case, make that buffer current and return it.\n\nThis uses `display-buffer' as a subroutine.  The optional ACTION\nargument is passed to `display-buffer' as its ACTION argument.\nSee `display-buffer' for more information.  ACTION is t if called\ninteractively with a prefix argument, which means to pop to a\nwindow other than the selected one even if the buffer is already\ndisplayed in the selected window.\n\nIf a suitable window is found, select that window.  If it is not\non the selected frame, raise that window's frame and give it\ninput focus.\n\nOptional third arg NORECORD non-nil means do not put this buffer\nat the front of the list of recently selected ones." (interactive #f(compiled-function () #<bytecode 0x36dc5c1>)) #<bytecode 0x10008f5af>)(#<buffer configmain.org> (display-buffer-same-window (inhibit-same-window)) nil)
  apply(#f(compiled-function (buffer-or-name &optional action norecord) "Display buffer specified by BUFFER-OR-NAME and select its window.\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf it is a string not naming an existent buffer, create a buffer\nwith that name.  If BUFFER-OR-NAME is nil, choose some other\nbuffer.  In either case, make that buffer current and return it.\n\nThis uses `display-buffer' as a subroutine.  The optional ACTION\nargument is passed to `display-buffer' as its ACTION argument.\nSee `display-buffer' for more information.  ACTION is t if called\ninteractively with a prefix argument, which means to pop to a\nwindow other than the selected one even if the buffer is already\ndisplayed in the selected window.\n\nIf a suitable window is found, select that window.  If it is not\non the selected frame, raise that window's frame and give it\ninput focus.\n\nOptional third arg NORECORD non-nil means do not put this buffer\nat the front of the list of recently selected ones." (interactive #f(compiled-function () #<bytecode 0x36dc771>)) #<bytecode 0x10008f5af>) (#<buffer configmain.org> (display-buffer-same-window (inhibit-same-window)) nil))
  pop-to-buffer(#<buffer configmain.org> (display-buffer-same-window (inhibit-same-window)) nil)
  pop-to-buffer-same-window(#<buffer configmain.org>)
  find-file("d:/21_personal/configs/configmain.org")
  ranger-find-file()
  funcall-interactively(ranger-find-file)
  call-interactively(ranger-find-file nil nil)
  command-execute(ranger-find-file)

When I toggle zi to literal (disableing preview) it works as expected
Setting(setq ranger-parent-depth)to 2 opens 3 folder windows + the preview and on opening a file fails to close the last folder window.
Setting it to 0 opens one window + the preview and actually gets closed properly.

Same thing happenes when (setq ranger-show-literal t) is set or the default value is used and a file is opened after a zi is issued.

My config snippet that reproduces the problem:

#+BEGIN_SRC emacs-lisp
(use-package ranger)
(global-set-key (kbd "C-x C-f") 'ranger)
; Preview org-files, toggle with "zi"
(setq ranger-show-literal nil)
; Show all files, toggle with "zh"
(setq ranger-show-hidden t)
(setq ranger-cleanup-on-disable t)
(setq ranger-cleanup-eagerly t)
(ranger-override-dired-mode t)
(setq ranger-parent-depth 2)
(setq debug-on-error '(wrong-type-argument))
#+END_SRC

Using Emacs 26.1, org 9.1.9 and the latest ranger build from melpa

Love your work! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant