1

I can't believe I'm saying this, but one thing that is "nice" about windows cmd is the pager. When I do man grep in a bash shell inside emacs buffer it spits out the entire content at once. Is there a way/mode to have emacs buffer to halt outputting text and ask if I want to see more.

Running GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30 on "ON NOOO! But can't run anything else" --> Windows 10.

here is what I have for running a bash shell buffer.

  ;;git bash
  (defun git-bash () (interactive)
    (let ((explicit-shell-file-name "d:/Installed_progs/Git/bin/bash.exe"))
      (call-interactively 'shell)
      (setq explicit-bash.exe-args '("--noediting" "--login" "-i"))))

To make it more concrete, here is what I see if I run man grep enter image description here

The command output filled the entire screen and keeps going until the end of the text.

Here is what I see when I run the same command in win cmd

enter image description here

Pages shows only what fits in one screen and waits. Is there any way to have that type of behavior in a bash shell in emacs?

  • You have asked a question about eshell (as per your title), and rejected an answer because you don't use eshell. Further, there are several ways to run a shell in Emacs, and neither of the ones I use (M-x shell and M-x term) will dump an entire man page to the terminal when you do man grep. Can you please explain how you are running a shell in Emacs, and also what version of Emacs and which OS you have? Otherwise this question doesn't make sense. – Tyler Sep 18 at 21:19
  • @tyler you are right, the title was wrong. Typed too fast. I've updated the title and included some additional info – A_P Sep 19 at 13:54
  • 1
    Ok, thanks for the clarification. I think this must be Windows-specific, as the behaviour I see using your code on Linux is a little different. I do have Emacs on a Windows machine that I can take a look at. In the meantime, you might like M-x man grep <return>. It's only one more keystroke (you need to type M-x` at the beginning), but it gives you something much nicer than a simple pager. At least, I think M-x man works on Windows? – Tyler Sep 19 at 14:18
2

If you are using EShell the following works: man grep: Add "man" to the list value of eshell-visual-commands and use *man grep instead of man grep at the command line of Eshell.

Background:

  • The commands in eshell-visual-commands are started in term-mode which allows paging if the command does do that.

  • man has an Eshell-own Elisp implementation eshell/man which calls the usual man command of Emacs. If an Elisp version of a command exists you can enforce calling the external command by prefixing it with a star. Therefore, you need to call *man instead of man in Eshell.


git log: Follow the instructions in the documentation of the variable eshell-visual-subcommands:

An alist of the form

((COMMAND1 SUBCOMMAND1 SUBCOMMAND2...) (COMMAND2 SUBCOMMAND1 ...))

of commands with subcommands that present their output in a visual fashion. A likely entry is

("git" "log" "diff" "show")

because git shows logs and diffs using a pager by default.

  • Thank you for the answer, but I don't really use Eshell. I'm using git-bash shell as my main. – A_P Sep 18 at 12:29
  • 2
    @A_P Since you did not specify the shell in your question this remains a valid answer. You should be more specific in your question. If you edit your question please mark it as EDIT to keep this a valid answer of your original question. – Tobias Sep 18 at 12:47

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.