Skip to content

counsel-ag + wgrep not working (No changes to be performed) #1841

@m-renaud

Description

@m-renaud

Overview

I have two machines, both running Debian and emacs v26.1, with the same counsel, swiper, wgep, and wgrep-ag packages installed. On one of them the workflow: counsel-ag, ivy-occur, ivy-wgrep-change-to-wgrep-mode works perfectly fine. I can edit the occur buffer then press C-x C-s to save and everything is updated properly. On the other, the occur buffer looks slightly different and when I try to save it says (No changes to be performed).

Strangely, for the working setup, ivy is not installed according the package manager, on the broken one it is (as a dependency of swiper), I'm not sure how this happened.

Occur buffer

Working:

-*- mode:grep; default-directory: "/home/mrenaud/" -*-


2 candidates:
./test.txt:2:b
./test.txt:4:b

Broken:

Ivy version: ivy-20181129.2105

-*- mode:grep; default-directory: "/home/mrenaud/" -*-


2 candidates:
    test.txt:2:b
    test.txt:4:b

The format in the broken one is different that the first which is (I assume) the problem. I'm confused because I've verified that the versions of the installed packages are the same (other than the missing ivy dependency on the working setup).

What I've tried

Uninstall and re-install

  • Uninstall all relevant packages (ivy, counsel, swiper, wgrep, wgrep-ag)
  • Restart emacs
  • Install ivy, counsel, swiper
  • Restart emacs
  • Install wgrep, wgrep-ag

remove .elc files
Removed all relevant .elc files in case there was some compile incompatibility

Edit: Summary of thread for future readers

The root cause of the issue is ivy--occur-insert-lines is adding leading spaces before the candidate matches when creating the ivy-occur buffer when the candidate string does not start with a . (which it does not for ag v2.1.0. wgrep requires that all candidates start at column 0 of the line.

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