atomontage / xterm-color

ANSI & xterm-256 color text property translator for Emacs
BSD 2-Clause "Simplified" License
219 stars 20 forks source link

"Symbol's value as variable is void: eshell-preoutput-filter-functions" #4

Closed chris-martin closed 8 years ago

chris-martin commented 8 years ago

When I add the code from this project's readme to my config, emacs fails with this error:

Symbol's value as variable is void: eshell-preoutput-filter-functions

Emacs 24.5.2

atomontage commented 8 years ago

Hi,

Have you loaded eshell?

ELISP> (featurep 'eshell) t

ELISP> (describe-variable 'eshell-preoutput-filter-functions)

("eshell-preoutput-filter-functions is a variable defined in `esh-mode.el'.\nIts value is (xterm-color-filter)\nOriginal value was nil\n\n This variable may be risky if used as a file-local variable.\n\nDocumentation:\nFunctions to call before output is inserted into the buffer.\nThese functions get one argument, a string containing the text to be\ninserted. They return the string as it should be inserted.\n\nYou can customize this variable." 60 71

(button (t) category help-variable-def-button help-args (eshell-preoutput-filter-functions "/Users/johnny/emacs-24.5/share/emacs/24.5/lisp/eshell/esh-mode.el")) 410 419 (button (t) category help-customize-variable-button help-args (eshell-preoutput-filter-functions)))

Try: (require 'eshell) before using anything eshell-specific (such as said hook) if not.

Chris

On Thu, 31 Mar 2016 21:41:22 -0700, Chris Martin notifications@github.com wrote:

When I add the code from this project's readme to my config, emacs fails with this error:

Symbol's value as variable is void: eshell-preoutput-filter-functions

Emacs 24.5.2

chris-martin commented 8 years ago

Thanks. So the full config I ended up with is:

(require 'eshell)
(require 'xterm-color)

(add-hook 'eshell-mode-hook
          (lambda () (progn
            (setq xterm-color-preserve-properties t)
            (setenv "TERM" "xterm-256color"))))

(add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)

(setq eshell-output-filter-functions
    (remove 'eshell-handle-ansi-color eshell-output-filter-functions))
seagle0128 commented 5 years ago

Some people have the same issue, and the correct solution should be:

(with-eval-after-load 'esh-mode
  (add-hook 'eshell-mode-hook
          (lambda () (progn
            (setq xterm-color-preserve-properties t)
            (setenv "TERM" "xterm-256color"))))

  (add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)

  (setq eshell-output-filter-functions
  (remove 'eshell-handle-ansi-color eshell-output-filter-functions))
)