Mercurial > emacs
comparison lisp/progmodes/compile.el @ 53978:227623e374e8
(compilation-directory): New defvar.
(compile): Save current directory in compilation-directory.
(recompile): Bind default-directory to compilation-directory if
that is non-nil.
author | Eli Zaretskii <eliz@is.elta.co.il> |
---|---|
date | Mon, 16 Feb 2004 12:50:24 +0000 |
parents | 9c894a0b07df |
children | 63ef4a00326a |
comparison
equal
deleted
inserted
replaced
53977:980fc678e13c | 53978:227623e374e8 |
---|---|
383 the LINE-IDX'th subexpression gives the line number. If COLUMN-IDX is | 383 the LINE-IDX'th subexpression gives the line number. If COLUMN-IDX is |
384 given, the COLUMN-IDX'th subexpression gives the column number on that line. | 384 given, the COLUMN-IDX'th subexpression gives the column number on that line. |
385 If any FILE-FORMAT is given, each is a format string to produce a file name to | 385 If any FILE-FORMAT is given, each is a format string to produce a file name to |
386 try; %s in the string is replaced by the text matching the FILE-IDX'th | 386 try; %s in the string is replaced by the text matching the FILE-IDX'th |
387 subexpression.") | 387 subexpression.") |
388 | |
389 (defvar compilation-directory nil | |
390 "Directory to restore to when doing `recompile'.") | |
388 | 391 |
389 (defvar compilation-enter-directory-regexp-alist | 392 (defvar compilation-enter-directory-regexp-alist |
390 '( | 393 '( |
391 ;; Matches lines printed by the `-w' option of GNU Make. | 394 ;; Matches lines printed by the `-w' option of GNU Make. |
392 (".*: Entering directory `\\(.*\\)'$" 1) | 395 (".*: Entering directory `\\(.*\\)'$" 1) |
576 '(compile-history . 1))) | 579 '(compile-history . 1))) |
577 (list (eval compile-command)))) | 580 (list (eval compile-command)))) |
578 (unless (equal command (eval compile-command)) | 581 (unless (equal command (eval compile-command)) |
579 (setq compile-command command)) | 582 (setq compile-command command)) |
580 (save-some-buffers (not compilation-ask-about-save) nil) | 583 (save-some-buffers (not compilation-ask-about-save) nil) |
584 (setq compilation-directory default-directory) | |
581 (compile-internal command "No more errors")) | 585 (compile-internal command "No more errors")) |
582 | 586 |
583 ;; run compile with the default command line | 587 ;; run compile with the default command line |
584 (defun recompile () | 588 (defun recompile () |
585 "Re-compile the program including the current buffer. | 589 "Re-compile the program including the current buffer. |
586 If this is run in a compilation-mode buffer, re-use the arguments from the | 590 If this is run in a compilation-mode buffer, re-use the arguments from the |
587 original use. Otherwise, it recompiles using `compile-command'." | 591 original use. Otherwise, it recompiles using `compile-command'." |
588 (interactive) | 592 (interactive) |
589 (save-some-buffers (not compilation-ask-about-save) nil) | 593 (save-some-buffers (not compilation-ask-about-save) nil) |
590 (apply 'compile-internal (or compilation-arguments | 594 (let ((default-directory (or compilation-directory default-directory))) |
591 `(,(eval compile-command) "No more errors")))) | 595 (apply 'compile-internal (or compilation-arguments |
596 `(,(eval compile-command) | |
597 "No more errors"))))) | |
592 | 598 |
593 (defcustom compilation-scroll-output nil | 599 (defcustom compilation-scroll-output nil |
594 "*Non-nil to scroll the *compilation* buffer window as output appears. | 600 "*Non-nil to scroll the *compilation* buffer window as output appears. |
595 | 601 |
596 Setting it causes the compilation-mode commands to put point at the | 602 Setting it causes the compilation-mode commands to put point at the |