Fixing xref-find-references
I was annoyed that
And actually, to work completely like xref-find-references I added one option to the ag command,
Much better. Are all those other packages worth digging into? I'm not particularly unhappy with ido.
xref-find-references
searched more than the files in the TAGS file (it seems to search everything below the top level directory of the TAGS file?) so I went looking for a fix. I found that apparently my emacs knowledge is out of date (the fact that it's xref now and not tags was my first clue). I couldn't find any way to customize xref-find-references
. Instead I found people referring to project, ivy, helm, confirm, The Silver Searcher (ag), ripgrep (rg), and dumb jump. I didn't go all the way and get into project or ivy or any of the others, but I did download ag and rg and tried them from a command-line outside of emacs and saw exactly what I was expecting xref-find-references
to do. I figured all I needed was to replace xref-find-references with one of those. I got ag.el installed and working before any of the ripgrep packages (there's both rg.el and ripgrep.el) and then struggled to remap M-? to call ag-project
instead of xref-find-references. The thing that finally worked was remapping commands. Here's the magic:(define-key global-map [remap xref-find-references] 'ag-project)
And actually, to work completely like xref-find-references I added one option to the ag command,
--word-regexp
, like so (oh, I also removed --stats
which is there by default in ag.el):(setq ag-arguments (list "--word-regexp" "--smart-case"))
Much better. Are all those other packages worth digging into? I'm not particularly unhappy with ido.
Comments