abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.31k stars 338 forks source link

Trying to save after `counsel-ag` on symlinks DELETES the original file! #2001

Open alienbogart opened 5 years ago

alienbogart commented 5 years ago

Runtime Environment

Issue

After I switch to a file using this function:

(defun my/emacs-dir-counsel-ag ()
  (interactive)
  (counsel-ag nil "~/.emacs.d/.links"))

, which contains symlinks to various configuration files, if I modify and try to save the original file is immediately deleted. The only way to save it is by copying its contents to another file. For most commands, though, Emacs will present the message: Wrong type argument: number-or-marker-p, nil, requiring a restart in order to be usable again.

abo-abo commented 5 years ago

What's your counsel-ag-base-command?

alienbogart commented 5 years ago

I removed any counsel-ag configuration in order to debug this issue.

abo-abo commented 5 years ago

I can't reproduce the issue. Looks like a problem with your config.

I did:

(setq counsel-ag-base-command "ag --nocolor --nogroup -f %s")
(counsel-ag nil "~/Downloads/temp")

If you don't add -f to the ag command, it won't even open any symlinks.

alienbogart commented 5 years ago

Okay, I did remove the configuration but the files were not tangled. Sorry about that. It seems to work fine without -f, and it actually does follow the symlinks using the same function. Saving seems to be working fine. I'll observe the behavior a little more before closing myself.

alienbogart commented 5 years ago

It wasn't really showing symlinks. I tried (setq counsel-ag-base-command "ag --nocolor --nogroup -f %s") and the issue came back.