0

I can't seem to find the keybinding for closing a buffer after running man in eshell. C-h b doesn't help. Neither does killing a man buffer, because eshell is unresponsive afterwards. What am I missing here?

Edit:

I've isolated code from my init file that caused the problem. It's a function to choose a popup window automatically.

(setq split-window-preferred-function 'my/split-window-func)
(defun my/split-window-func (&optional window)
  (let ((new-window (split-window-sensibly window)))
    (if (not (active-minibuffer-window))
        (select-window new-window))))

This function causes a popup window to open in Fundamental mode instead of Man mode and makes eshell buffer read-only. Why does this happen?

1

Usually when you run man in eshell it runs the Emacs "man" command which pops the man page up in another window, and you get an eshell prompt back right away. Given you say that eshell is unresponsive it sounds as though you've managed to run the actual "man" command instead of the Emacs one. You can verify which command it runs by typing which man at the eshell prompt - for me it says "eshell/man is a compiled Lisp function in ‘em-unix.el’". You can also force it to run the Emacs command by doing something like eshell/man ls (for example), but it ought to do this by default.

In your case your split window function is calling (select-window new-window) which is causing eshell to hit the following error:

Lisp error: (error "Marker points into wrong buffer" #)

You can tell this by calling the toggle-debug-on-error function before running the man command. This drops you into the Emacs debugger where you can see the error and the stack of calls that lead up to it (press 'q' to quit when done). I suspect the problem may be that you've selected the new window as well as just returning it.

  • which command does say eshell/man. – hks Jul 2 '17 at 16:57
  • That's odd. What happens if you start a fresh emacs with -Q to prevent it loading your init file etc. and then do eshell, man ls? Does it work then? It might also be useful to know what platform you're on, what Emacs version you have, and even a screenshot of the problem could help. – stevoooo Jul 2 '17 at 18:23
  • You were right. Starting emacs with -q resolved the issue. I isolated code that was the problem. Look at the edit of my question. – hks Jul 2 '17 at 18:32
  • Edited answer to try and explain what's going on... – stevoooo Jul 2 '17 at 22:21
0

C-x o (other-window, to switch from the eshell to the man buffer) followed by q (quit-window) should help.

Note that quit-window also accepts a prefix argument, so C-u q kills the buffer instead of burying it. This is equivalent to pressing k (Man-kill).

  • Ok I just noticed that Man buffer opens in fundamental mode. After switching to Man mode I can kill it with q, but then eshell is still unresponsive telling me that buffer is read only. Why does it do that? – hks Jul 2 '17 at 17:01
  • Is the read-only eshell buffer now in Man-mode perchance? – phils Jul 3 '17 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.