Open tomjakubowski opened 7 years ago
Taking a quick look at that, it seems like highlighting goes off the rails whenever there is more than one match on a single line.
What's the full ag command you're running? It should be at the top of the *Ag*
buffer.
ag --literal --group --line-number --column --color --color-match 30\;43 --color-path 1\;32 --smart-case --stats -- registry .
:wave: Just noting here that I was able to stop the over-aggressive highlighting by applying the following patch:
diff --git a/ag.el b/ag.el
index a41d7c5..bea9a7f 100644
--- a/ag.el
+++ b/ag.el
@@ -215,8 +215,7 @@ If REGEXP is non-nil, treat STRING as a regular expression."
(unless (equal (car (last arguments)) "--")
(setq arguments (append arguments '("--"))))
(setq arguments
- (append '("--line-number" "--column" "--color" "--color-match" "30;43"
- "--color-path" "1;32")
+ (append '("--line-number" "--column" "--nocolor")
arguments))
(if ag-group-matches
(setq arguments (cons "--group" arguments))
It makes for a plainer results buffer, but I am now able to see what I was searching for again 😄. Sadly, I don't yet understand why this change fixes the highlighting.
Edit: Unfortunately, something about this breaks my ability to navigate from search results to source buffers 😞
Not sure is this is applicable to the errors others are reporting, but I was having seemingly the same issue, and I tracked it down to the fact that the Ag output buffers have compilation-mode
as a parent mode. I had a hook for dealing with ANSI color codes in compilation buffers (as many people do ex1, ex2, ex3, ex4) that was breaking Ag coloring.
By modifying my hook to only run in buffers that have compilation-mode
as their major-mode
, this highlighting issue disappeared for me. New hook code:
(ignore-errors
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(when (eq major-mode 'compilation-mode)
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer))
@tomjakubowski Your text can be read even with difficulty, here is my (I run M-x ag IgnoreUnlessSpelledInSource in llvm source tree, ag 20201031.2202):
On my machine, the output of
ag --version
is:My Emacs version is: 25.0.92.1
I'm using: OS X 10.11
First off, thank you so much for ag.el. The
C-c a
keys on my keyboard are wearing down at an impressive rate thanks to your plugin :-)I've been struggling with this bug for some time now, but finally managed to make it happen in a directory I'm allowed to share screenshots of.
If I execute
C-h v ag-highlight-search
, it tells me the value is nil.And yet! When I run
M-x ag
I see some words highlighted. Sometimes, it's just the word I searched for -- though not all instances of that word are highlighted. Other times, the highlighting goes off the rails and it continues well past the end of the word I searched for.Here's a screenshot:
(note to self: repro by searching
registry
in the meow root dir)I'm working on a reproduction that's both small and which I'd be allowed to share with you, but maybe the screenshot will be enough for you to see where the problem is.