[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to recompile single file or rerun single compilation command in
Re: How to recompile single file or rerun single compilation command in compilation mode ?
Thu, 8 Mar 2012 13:21:40 -0500
It works great!
Thanks very much!
On Thu, Mar 8, 2012 at 3:40 AM, Thien-Thi Nguyen <address@hidden>
The previous code fails if COMMAND starts with a relative directory.
This version is more robust in that regard:
(let ((default-directory (file-name-as-directory dir)))
(defun compilation-compile-with-current-line (dir)
"Extract the current line as a command and execute it in DIR."
(interactive "DExecute command in directory: ")
(let ((command (substring-no-properties (thing-at-point 'line) 0 -1)))
;; Do it this way instead of using "cd DIR; COMMAND"
;; to avoid outrageous prefixing on repeated invocations.