From: "Alfred M. Szmidt" <ams@kemisten.nu>
Cc: help-gnu-emacs@gnu.org
Subject: Re: compile and the current directory
Date: Fri, 16 Jan 2004 12:22:08 +0100 (MET) [thread overview]
Message-ID: <200401161122.i0GBM817012684@hamberg.it.uu.se> (raw)
In-Reply-To: <87isjcchlo.fsf@emptyhost.emptydomain.de> (message from Kai Grossjohann on Fri, 16 Jan 2004 11:28:51 +0100)
I have a project which contains a Makefile at its root directory.
Running make for me means to change to that directory before
running make.
I have been meaning to implement something like that, but for
`recompile' instead. Make more sense to have `compile' record the
directory one compiles in, and then have `recompile' restore it.
Anyway, I whiped up the following patch, it seems to work.
--- compile.el~ Sun Nov 23 21:57:47 2003
+++ compile.el Fri Jan 16 12:20:32 2004
@@ -386,6 +386,9 @@
try; %s in the string is replaced by the text matching the FILE-IDX'th
subexpression.")
+(defvar compilation-directory nil
+ "Directory to restore to when doing `recompile'.")
+
(defvar compilation-enter-directory-regexp-alist
'(
;; Matches lines printed by the `-w' option of GNU Make.
@@ -578,6 +581,7 @@
(unless (equal command (eval compile-command))
(setq compile-command command))
(save-some-buffers (not compilation-ask-about-save) nil)
+ (setq compilation-directory default-directory)
(compile-internal command "No more errors"))
;; run compile with the default command line
@@ -587,8 +591,13 @@
original use. Otherwise, it recompiles using `compile-command'."
(interactive)
(save-some-buffers (not compilation-ask-about-save) nil)
- (apply 'compile-internal (or compilation-arguments
- `(,(eval compile-command) "No more errors"))))
+ (let (olddir default-directory)
+ (unless (eq compilation-directory nil)
+ (setq default-directory compilation-directory))
+ (apply 'compile-internal (or compilation-arguments
+ `(,(eval compile-command) "No more errors")))
+ (setq default-directory olddir)))
+
(defcustom compilation-scroll-output nil
"*Non-nil to scroll the *compilation* buffer window as output appears.
next prev parent reply other threads:[~2004-01-16 11:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-16 10:28 compile and the current directory Kai Grossjohann
2004-01-16 11:22 ` Alfred M. Szmidt [this message]
2004-01-18 17:12 ` Kai Grossjohann
[not found] ` <mailman.760.1074252175.928.help-gnu-emacs@gnu.org>
2004-01-16 18:40 ` Kevin Rodgers
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=200401161122.i0GBM817012684@hamberg.it.uu.se \
--to=ams@kemisten.nu \
--cc=help-gnu-emacs@gnu.org \
/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).