atomontage / xterm-color

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

Strange prompt printing at startup and no bold font #22

Closed ChoppinBlockParty closed 6 years ago

ChoppinBlockParty commented 6 years ago

I have configuration for my shell-mode like this

(setq comint-output-filter-functions
      (remove'ansi-color-process-output comint-output-filter-functions))

(defun my-shell-mode-hook ()
  "A hook to setup shell-mode."
  (add-hook 'comint-preoutput-filter-functions 'xterm-color-filter nil t)
  ;;; For ANSI colors
  ;; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
  ;;; Removes face inherited from minibuffer
  (face-remap-set-base 'comint-highlight-prompt :inherit nil)
  ;;; You can highlight some text based on regexp (useful to see "OK" or warnings):
  ;; (add-hook 'shell-mode-hook (lambda () (highlight-regexp "\\[OK\\]" "hi-green-b")))
  ;;; Make URLs clickable
  (goto-address-mode)
  ;;; Make file paths clickable
  ;;; Every line representing a path to a file will be colorized and made clickable, so that you can jump to that file and that line, like in compilation-mode (specially useful when compiling a program or running tests):
  (compilation-shell-minor-mode)
  (comint-read-input-ring t)
  )
(add-hook 'shell-mode-hook 'my-shell-mode-hook)

After adding relevant to the plugin lines (mentioned in the doc) I get a weird printing of my prompt with escape terminal sequences at every startup. After that it seems to work fine and display colors, though one thing I have noticed is that it does not show bold font anymore, it is always regular font, where it is supposed to be bold. Moreover bold is replaced with yellow.

selection_013

In g++: fatal error: no input, g++ must be bold and white, not regular and yellow.

Any ideas?

ChoppinBlockParty commented 6 years ago

I have figured out the issue was that (setq comint-output-filter-functions ...) was set once, outside of shell-mode-hook. When I put it inside the hook like this:

(defun my-shell-mode-hook ()
  "A hook to setup shell-mode."
  (setq comint-output-filter-functions
    (remove'ansi-color-process-output comint-output-filter-functions))
  (add-hook 'comint-preoutput-filter-functions 'xterm-color-filter nil t)
  )
(add-hook 'shell-mode-hook 'my-shell-mode-hook)

The weird shell disappeared, and seems like bold font is not yet supported, follow #17.