From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: Nash Steve <nash11228@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to recompile single file or rerun single compilation command in compilation mode ?
Date: Thu, 08 Mar 2012 09:40:42 +0100 [thread overview]
Message-ID: <87zkbrfpth.fsf@gnuvola.org> (raw)
In-Reply-To: <878vjbh67f.fsf@gnuvola.org> (Thien-Thi Nguyen's message of "Thu, 08 Mar 2012 09:01:24 +0100")
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))))
next prev parent reply other threads:[~2012-03-08 8:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 19:54 How to recompile single file or rerun single compilation command in compilation mode ? Nash Steve
2012-03-06 23:10 ` Peter Dyballa
2012-03-07 15:44 ` Nash Steve
2012-03-07 18:21 ` Peter Dyballa
2012-03-08 8:01 ` Thien-Thi Nguyen
2012-03-08 8:40 ` Thien-Thi Nguyen [this message]
2012-03-08 18:21 ` Nash Steve
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zkbrfpth.fsf@gnuvola.org \
--to=ttn@gnuvola.org \
--cc=help-gnu-emacs@gnu.org \
--cc=nash11228@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).