From: "Alfred M. Szmidt" <ams@kemisten.nu>
Subject: [ams@kemisten.nu: Re: compile and the current directory]
Date: Sun, 18 Jan 2004 15:19:40 +0100 (MET) [thread overview]
Message-ID: <200401181419.i0IEJebD006785@hamberg.it.uu.se> (raw)
Hi,
It would be nice to see the following in future emacsen, I know that I
often have to edit several files that are all over the place, but
always want to run the same command, in the same directory. The
current `recompile' doesn't restore the working directory where you
actually ran `compile' in, with this patch it saves the value, and
then restores the working directory when doing `recompile'.
Cheers.
------- Start of forwarded message -------
Date: Fri, 16 Jan 2004 12:22:08 +0100 (MET)
From: "Alfred M. Szmidt" <ams@kemisten.nu>
To: Kai Grossjohann <kai@emptydomain.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: compile and the current directory
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.
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
------- End of forwarded message -------
next reply other threads:[~2004-01-18 14:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-18 14:19 Alfred M. Szmidt [this message]
2004-01-19 10:01 ` [ams@kemisten.nu: Re: compile and the current directory] Richard Stallman
2004-01-20 7:12 ` Alfred M. Szmidt
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=200401181419.i0IEJebD006785@hamberg.it.uu.se \
--to=ams@kemisten.nu \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).