Wilfred / ag.el

An Emacs frontend to The Silver Searcher
http://agel.readthedocs.org/en/latest/
525 stars 61 forks source link

ag-match-face can not propertize matched string #150

Open nrsaty opened 6 years ago

nrsaty commented 6 years ago

My environment: Windows/10 + msys2 emacs 26.0.90 ag 2.1.0 ag-el 0.48

My ag seems not output ANSI color sequence when --vimgrep specified. So, ag-el can not colorize matched string in result buffer.

Example output in mintty.Command is as follows: ag --vimgrep --literal --group --line-number --column - -color --color-match '30;43' --color-path '1;32' --smart-case --stats --el -- 'mode-line' .

Result: without --vimgrep ESC[1;32mw32-ime.elESC[0mESC[K ESC[1;33m24ESC[0mESC[K:22:(defvar w32-ime-show-ESC[30;43mmode-lineESC[0mESC[K t ESC[1;33m26ESC[0mESC[K:17:(defvar w32-ime-ESC[30;43mmode-lineESC[0mESC[K-state-indicator

with --vimgrep (which is neccesary for ag.el) w32-ime.el:24:22:(defvar w32-ime-show-mode-line t w32-ime.el:26:17:(defvar w32-ime-mode-line-state-indicator "[O]"

Obviously, this cause the problem. Does anybody resolve this?

nrsaty commented 5 years ago

I found a solution. --vimgrep option is disturbing highlight, and it is introduced for issue 101 fix. When using emacs on msys2, this fix did not needed. Comment out following line from ag.el (from line 234-236), and everything worked normaly.

;; (when (or (eq system-type 'windows-nt) (eq system-type 'cygwin))
;;   ;; Use --vimgrep to work around issue #97 on Windows.
;;   (setq arguments (cons "--vimgrep" arguments)))

I am using self-build emacs on msys2. Do not know about pre-build version on msys2 (installed by pacman).