schell / steeloverseer

A file watcher and development tool.
BSD 3-Clause "New" or "Revised" License
128 stars 15 forks source link

Can't prevent sos from triggering on emacs lock files #40

Open Martinsos opened 4 years ago

Martinsos commented 4 years ago

Hi! I have emacs creating files like .#myfile.txt when I am editing a file, and sos triggers on those (runs the command). This is not the behaviour I want, so I tried using -e to exclude those, but I just can't get it to work! I tried following:

-e "#"
-e "\.#"
-e ".*\.#.*"

and non of those excludes the files in question from triggering sos.

The message I get is Added: foo/bar/.#yourfile.txt. So it seems to be triggering only on adding the emacs lock file, not modifying it. Is it possible that -e matches only modified files and not added ones?

Am I doing smth wrong? Thank you!

Btw. I am on Archlinux, I am running sos on a directory, and sos version is 2.0.2.

Prillan commented 4 years ago

Related: https://github.com/schell/steeloverseer/issues/12

schell commented 4 years ago

Thanks @Martinsos - I'll look into it.

schell commented 4 years ago

Try -e \# and tell me if that helps. I typically use a number of .sosrc files for my projects and they all look a bit like this (where ... is replaced with your specific patterns and commands):

- pattern: ...
  excludes: 
  - \# 
  - flycheck 
  commands: 
  - stack exec ...
Martinsos commented 4 years ago

@schell Thanks for the suggestion, but it does not work! I tried -e \# and -e "\#" and none of those worked. I did this in command line, not from .sosrc.

peterbecich commented 1 year ago

@Martinsos , what about this

sos . -p ".*\.hs" -e ".*\#.*\.hs" -c "echo 'hello'"

I have tested it to watch all hs files in a directory, and ignore all hs Emacs lock files; I believe it works: https://github.com/peterbecich/halogen-chess/blob/7e67a560d7482e35ff19c6eb29426147b8135819/flake.nix#L211