I want to write some lisp that will take the cwd, and keep traversing up the dirctory tree until it finds a file (in this case config.rb) then when it finds it I want to parse the contents (in this case:
for example to extract the value for sass_dir
Then I want to navigate back into that directory.
This is all because the scss compile mode doesnt work as it tries to compile in the CWD of the buffer which is not how compass works.
I've been wanting to develop my lisp skills anyhow so learning the above techniques would be great if anyone can help.
I have done:
(defcustom scss-sass-command "compass compile" "Command used to compile SCSS files, should be sass or the complete path to your sass runnable example:" :group 'scss) (defun get-compass-root-dir() "Get the root folder for the sass project to run compass command in" (locate-dominating-file buffer-file-name "config.rb")) (defun scss-compile() "Compiles the directory belonging to the current buffer, using the option" (interactive) (message (get-compass-root-dir)) (let ((default-directory (get-compass-root-dir)))) (message (pwd)) (compile scss-sass-command))
But I just dont seem to be nailing it. Compass complains there are no files to compile and my attempts to message out the directories to see what is going on dont seem to be working. I have byte compiled the file and relaunced emacs.
Anybody have any suggestions?