Skip to content

custom color settings in .ripgreprc and xterm-color-filter break rg-results #65

@nverno

Description

@nverno

It took me a bit to figure out what was wrong here, and I don't think it is documented
anywhere. Here are a couple issues I ran into:

  1. If custom colors are defined in ~/.ripgreprc, eg. --colors=path:fg:cyan etc. then
    font-locking and other functions in the rg-results buffer don't work.

  2. Using xterm-color-filter also breaks rg's compilation (from xterm-color library)
    I usually use xterm-color-filter in my compilation-start-hook to interpret shell escapes,
    however, since rg (like ag.el) relies on shell escapes for parsing, font-lock/other functions
    also break in the rg-results buffer.

Quick fix is to remove xterm-color support around rg-run

(define-advice rg-run (:around (orig-fn &rest args) "no-xterm-color")
  (let ((compilation-start-hook
         (remove 'my-compilation-start-hook compilation-start-hook))
        compilation-environment)
    (apply orig-fn args)))

It looks like it would probably be out-of-the question to add support to rg-results that
didn't rely on escape codes, but it might be helpful to mention incompatibilities somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions