-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ag.el is highlighting (to the extreme) even when ag-highlight-search is nil #124
Comments
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 |
|
👋 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 😞 |
+ Updated org package source to get up-to-date releases (read here)[http://irreal.org/blog/?p=6899] + Had an issue very similar to what was described (here)[Wilfred/ag.el#124], tracked this down to the fact that Ag major mode inherits from compilation mode. My hook for colorizing the ANSI colors was breaking Ag coloring. Hook now only runs if major mode is compilation-mode. Seems to work for all packages in my normal workflow right now. Note that many people recommend using `compilation-filter-start' variable instead of `(point-min)' and `(point-max)' (see (for example here)[https://stackoverflow.com/questions/13397737/ansi-coloring-in-compilation-mode], but that wasn't working for me. Didn't bother to track down
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 By modifying my hook to only run in buffers that have (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)) |
Some modes have compilation-mode has parent mode but the ansi coloring scheme is breaking their highlighting. i.e. Wilfred/ag.el#124 Fix this by applying ansi-colors only when the major mode is compilation-mode. Signed-off-by: Loys Ollivier <[email protected]>
Some modes have compilation-mode as parent mode but the ansi coloring scheme is breaking their highlighting. i.e. Wilfred/ag.el#124 Fix this by applying ansi-colors only when the major mode is compilation-mode. Signed-off-by: Loys Ollivier <[email protected]>
Some modes have compilation-mode as parent mode but the ansi coloring scheme is breaking their highlighting. i.e. Wilfred/ag.el#124 Fix this by applying ansi-colors only when the major mode is compilation-mode. Signed-off-by: Loys Ollivier <[email protected]>
Some modes have compilation-mode as parent mode but the ansi coloring scheme is breaking their highlighting. i.e. Wilfred/ag.el#124 Fix this by applying ansi-colors only when the major mode is compilation-mode. Signed-off-by: Loys Ollivier <[email protected]>
@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.
The text was updated successfully, but these errors were encountered: