emacsorphanage / helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
GNU General Public License v3.0
689 stars 55 forks source link

Cache sometimes not cleared properly leading to wrong results [reproducable/fix] #112

Open olejorgenb opened 7 years ago

olejorgenb commented 7 years ago

Reproduce:

No results is displayed. This is due the line cache not being cleared when undoing into a state where the buffer isn't modified.

The relevant lines:

   (cond ((not (boundp 'helm-swoop-list-cache))
          (set (make-local-variable 'helm-swoop-list-cache) nil))
         ((buffer-modified-p)
          (setq helm-swoop-list-cache nil)))

Here: https://github.com/ShingoFukuyama/helm-swoop/blob/master/helm-swoop.el#L630

Might be what #106 is experiencing.

indigoviolet commented 7 years ago

@ShingoFukuyama -- is this fixable?

krizex commented 6 years ago

I have the same issue.

CeleritasCelery commented 6 years ago

This can be fixed by adding an advice around your undo function. I was trying to find a universal solution to this but I can't seem to find an undo primitive to use (for example undo-tree implements it's own functions).

(advice-add 'undo :after (lambda (&rest _) (helm-swoop--clear-cache)))
troglotit commented 5 years ago

I catch this quite frequently, most of the times when files changes on disk, for example when I checkout - Emacs changes the buffer, but cache persists.