Subject: Re: bug#19627: 25.0.50; eshell: only the first item from eshell-visual-options is honored

From: [email-masked]
Date: Sun, 03 Jul 2016 22:47:54 -0400

severity 19627 minor
quit

Samer Masterson <[email-masked]> writes:

> 1. "emacs -Q"
> 2. M-x eshell
> 3. "git --help" prints the help text to the buffer
> 4. (add-to-list 'eshell-visual-options '("git" "--help"))
> 5. "git --help" brings up the term display (which is quickly killed,
> that is bug#18108)
> 6. (add-to-list 'eshell-visual-options '("git" "--help"))

I guess you actually meant "--version" rather than "--help" again here.

> 7. "git --help"
> bug:
> "git --help" prints the help text to the buffer.
> expected behavior:
> "git --help" should have brought up a term-mode buffer, as it's still
> part of eshell-visual-options.

eshell-visual-options is an alist (as mentioned in the docstring), so
the newest "git" entry decides which options are in force.  To get what
you want, you should do:

  (add-to-list 'eshell-visual-options '("git" "--help" "--version"))

or possibly

  (push "--version" (cdr (assoc "git" eshell-visual-options)))

Maybe the docs can be improved to explain this better.  Is it enough to
change the example usage to have 2 different options?

>From c51bb7b36ef7f0bbe3e69c8fe16abc6b2ca8a6c1 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Sun, 3 Jul 2016 22:41:48 -0400
Subject: [PATCH v1] Clarify usage of eshell-visual-options

* lisp/eshell/em-term.el (eshell-visual-options): Add second option to
example usage.
---
 lisp/eshell/em-term.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index 3e5de0c..208629c 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -102,10 +102,11 @@ eshell-visual-options
 of commands with options that present their output in a visual
 fashion.  For example, a sensible entry would be
 
-  (\"git\" \"--help\")
+  (\"git\" \"--help\" \"--paginate\")
 
 because \"git <command> --help\" shows the command's
-documentation with a pager.
+documentation with a pager and \"git --paginate <command>\"
+always uses a pager for output.
 
 See also `eshell-visual-commands' and `eshell-visual-subcommands'."
   :type '(repeat (cons (string :tag "Command")
-- 
2.8.0