I am very new to Lisp - and especially to Elisp - and I have a problem handling strings:
I want to convert a Windows style style to a Unix style path - especially I need to convert the path I get from Visual Studio to the Cygwin path, since I want to be able to open the file from Visual Studio in Emacs (I hope to use emacsclient --eval for of this):
The Visual Studio path has the following format:
C:\Users\name\documents\visual studio 2010\projects\test
I want to change it to the appropriate Cygwin path, which would be as follows:
/cygdrive/c/Users/name/documents/visual studio 2010/projects/test
However, an attempt to execute the following in the zero buffer is no longer performed:
(replace-regexp-in-string "\\" "\/" "C:\users\someone") (subst-char-in-string ?\ ?/ "C:\users\someone") >> Debugger entered
Is there a way to make Elisp not escape the backslashes in each line?
EDIT :
This is how I call emacs from Visual Studio using external tools:
emacsclient -d 127.0.0.1:0.0 --eval '(convert-win-to-cygwin-path $(ItemPath))'
$ (ItemPath) will be replaced with C:\Users\asf , which I cannot influence, so it will pass a String with single backslash emacs, which I need to change in emacs.
Can I make emacs KNOW that it needs to make a double backslash from one backslash?
EDIT 2: Solution
I changed the way I try to start emacs by actually invoking a shell script that will run emacs - this way I can make sure emacs gets the correct path:
#!/bin/bash export PATH="/usr/bin/:/bin/:$PATH" filename=$1 line=$2 column=$3 cyged_path=$(cygpath "$filename") echo "Cyged path: $cyged_path" emacsclient -d 127.0.0.1:0.0 -n +$line:$column "$cyged_path"
And I call it from Visual Studio with the following arguments in the external tools window:
Path: <path_to_cygwin>\bin\bash.exe Arguments: <path_to_script> $(ItemPath) $(CurLine) $(CurCol)