help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to recompile single file or rerun single compilation command in


From: Nash Steve
Subject: Re: How to recompile single file or rerun single compilation command in compilation mode ?
Date: 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 <ttn@gnuvola.org> wrote:
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))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]