[Top][All Lists]

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

Re: compile command could note current directory in prompt

From: Kevin Rodgers
Subject: Re: compile command could note current directory in prompt
Date: Mon, 16 Jul 2001 10:05:12 -0600

Dan Jacobson wrote:
> Sometimes when you hit M-x compile when, say, you are looking at a
> *Buffer list* etc., you might not be sure exactly which directory you
> are in... in certain circumstances executing a 'make'  might have
> disastrous consequences.  Therefore, perhaps optionally the Compile
> command's prompt could remind one of the last directory component,
> just like many folks have their shell prompt rigged...
> Yes, after it begins execution, we see the "cd ..." but it would be
> perhaps nice to know beforehand ...
> or perhaps any such reminders would get ignored along with the other 999
> things on the screen, i dunno

With Emacs, all things are possible.  If that's what _you_ want, then _you_
should customize Emacs to do that.

Here's the `interactive' form for `compile' in lisp/progmodes/compile.el
from the 20.7 distribution:

   (if (or compilation-read-command current-prefix-arg)
       (list (read-from-minibuffer "Compile command: "
                                 compile-command nil nil
                                 '(compile-history . 1)))
     (list compile-command)))

Just advise `compile' to put the default directory in the prompt:

(defadvice compile (before interactive-read-command first activate)
  "Include the current directory in the prompt when reading COMMAND."
   (if (or compilation-read-command current-prefix-arg)
       (list (read-from-minibuffer (format "Compile command: cd %s; "
                                   compile-command nil nil
                                   '(compile-history . 1)))
     (list compile-command)))

Kevin Rodgers <kevinr@ihs.com>          Lead Software Engineer
Information Handling Services           Electronic Systems Development
15 Inverness Way East, M/S A114         GO BUFFS!
Englewood CO 80112-5776 USA             1+ (303) 397-2807[voice]/705-4258[fax]

reply via email to

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