|
From: | Thien-Thi Nguyen |
Subject: | Re: How to recompile single file or rerun single compilation command in compilation mode ? |
Date: | Thu, 08 Mar 2012 09:40:42 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
The previous code fails if COMMAND starts with a relative directory. This version is more robust in that regard: (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. (let ((default-directory (file-name-as-directory dir))) (compile command))))
[Prev in Thread] | Current Thread | [Next in Thread] |