Skip to content
Discussion options

You must be logged in to vote

rg already searches the readable files and prints their matches, it just also exits 2, and it's counsel that drops the output: counsel--sync-sentinel-on-exit replaces the candidate list with "error code 2" on a non-zero exit. So fix it on the Emacs side: a wrapper in PATH, with counsel-rg-base-command pointing at it instead of rg.

#!/bin/sh
rg --no-messages "$@"; rc=$?; [ $rc -eq 2 ] && exit 0; exit $rc

A bad regex then shows up as rg's error text in the list, fair trade.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@plotski
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants