unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to recompile single file or rerun single compilation command in compilation mode ?
@ 2012-03-06 19:54 Nash Steve
  2012-03-06 23:10 ` Peter Dyballa
  0 siblings, 1 reply; 7+ messages in thread
From: Nash Steve @ 2012-03-06 19:54 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 102 bytes --]

Hi All,

Does compilation-mode have a command to re-run single compile command, just
like recompile ?

[-- Attachment #2: Type: text/html, Size: 156 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to recompile single file or rerun single compilation command in compilation mode ?
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Dyballa @ 2012-03-06 23:10 UTC (permalink / raw)
  To: Nash Steve; +Cc: help-gnu-emacs


Am 6.3.2012 um 20:54 schrieb Nash Steve:

> Does compilation-mode have a command to re-run single compile command, just
> like recompile ?

You mean: "g"?

--
Greetings

  Pete

They're putting dimes in the hole in my head to see the change in me.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to recompile single file or rerun single compilation command in compilation mode ?
  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
  0 siblings, 2 replies; 7+ messages in thread
From: Nash Steve @ 2012-03-07 15:44 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

No, I does not mean "g" (recompile).
I want a command similar to "g" (recompile), but with finer control.

"g"(recompile) will re-run M-x compile with recent history. I want to run a
line in compilation-mode buffer as a compile command.
e.g. after M-x compile RET make, I just want to pick a line of make output
as a command to run.


On Tue, Mar 6, 2012 at 6:10 PM, Peter Dyballa <Peter_Dyballa@web.de> wrote:

>
> Am 6.3.2012 um 20:54 schrieb Nash Steve:
>
> > Does compilation-mode have a command to re-run single compile command,
> just
> > like recompile ?
>
> You mean: "g"?
>
> --
> Greetings
>
>  Pete
>
> They're putting dimes in the hole in my head to see the change in me.
>
>

[-- Attachment #2: Type: text/html, Size: 1099 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to recompile single file or rerun single compilation command in compilation mode ?
  2012-03-07 15:44   ` Nash Steve
@ 2012-03-07 18:21     ` Peter Dyballa
  2012-03-08  8:01     ` Thien-Thi Nguyen
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2012-03-07 18:21 UTC (permalink / raw)
  To: Nash Steve; +Cc: help-gnu-emacs


Am 7.3.2012 um 16:44 schrieb Nash Steve:

> e.g. after M-x compile RET make, I just want to pick a line of make output
> as a command to run.

Change directory in *shell* buffer and execute that line! So you'll have the *compilation* buffer with all errors and warnings and another compilation...

The other option is to erase the (default) compile command and substitute it with your line. Then the current working directory of the *compilation* buffer's process has to be that from which the file to be compiled can be reached.

--
Greetings

  Pete

Globalisation – communism from above.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to recompile single file or rerun single compilation command in compilation mode ?
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Thien-Thi Nguyen @ 2012-03-08  8:01 UTC (permalink / raw)
  To: Nash Steve; +Cc: help-gnu-emacs

() Nash Steve <nash11228@gmail.com>
() Wed, 7 Mar 2012 10:44:40 -0500

   I want to run a line in compilation-mode buffer as a compile
   command.  e.g. after M-x compile RET make, I just want to pick
   a line of make output as a command to run.

Maybe something like this (only lightly tested)?

(require 'thingatpt)

(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 dir))
      (compile (format "%s" command)))))

(define-key compilation-mode-map "\C-c\C-a" ; "a" for "again"
  'compilation-compile-with-current-line)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to recompile single file or rerun single compilation command in compilation mode ?
  2012-03-08  8:01     ` Thien-Thi Nguyen
@ 2012-03-08  8:40       ` Thien-Thi Nguyen
  2012-03-08 18:21         ` Nash Steve
  0 siblings, 1 reply; 7+ messages in thread
From: Thien-Thi Nguyen @ 2012-03-08  8:40 UTC (permalink / raw)
  To: Nash Steve; +Cc: help-gnu-emacs

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))))



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to recompile single file or rerun single compilation command in compilation mode ?
  2012-03-08  8:40       ` Thien-Thi Nguyen
@ 2012-03-08 18:21         ` Nash Steve
  0 siblings, 0 replies; 7+ messages in thread
From: Nash Steve @ 2012-03-08 18:21 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

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))))
>

[-- Attachment #2: Type: text/html, Size: 1026 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-08 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-03-08 18:21         ` Nash Steve

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).