Is there an easy way to have emacs save current buffer in two locations?
I could in the ‘after-save-hook’ programmatically copy the current file to a second location, but writing lisp code for that might take some time.
For those that are curious why I want this:
I want the changes I make to my JSP immediately be deployed in tomcat’s webapps/myapp directory.
So everytime I save a JSP file I want it saved in both my current version controlled source location as well as in the directory where my Tomcat application is deployed.
I can’t use symlinks because I use a windows machine and the destination location is a directory in Linux box that is exported through Samba.
Given the problem you are trying to solve is to deploy changes immediately, I would suggest writing a script (in your case a batch file) that invokes
rsyncwith the appropriate options. You could either run this in theafter-save-hook(which is probably overkill) or assign a hotkey to run it for you when you have made a set of changes that you want to test. Something like:where the script would look like this:
This is probably better than saving the same file in multiple places, as it ensures the deployment directory always matches what you have in your source repository.