*** /usr/local/emacs-21.3/lisp/progmodes/compile.el Fri Jan 17 06:45:11 2003 --- /usr/tmp/kevinr/compile.el Thu Jun 19 11:35:33 2003 *************** *** 571,577 **** and move to the source code that caused it. Interactively, prompts for the command if `compilation-read-command' is ! non-nil; otherwise uses `compile-command'. With prefix arg, always prompts. To run more than one compilation at once, start one and rename the \`*compilation*' buffer to some other name with \\[rename-buffer]. --- 571,578 ---- and move to the source code that caused it. Interactively, prompts for the command if `compilation-read-command' is ! non-nil; otherwise uses `compile-command'. With prefix arg, append the ! default target to `compile-command'. To run more than one compilation at once, start one and rename the \`*compilation*' buffer to some other name with \\[rename-buffer]. *************** *** 581,596 **** the function in `compilation-buffer-name-function', so you can set that to a function that generates a unique name." (interactive ! (if (or compilation-read-command current-prefix-arg) (list (read-from-minibuffer "Compile command: " ! (eval compile-command) nil nil ! '(compile-history . 1))) ! (list (eval compile-command)))) (unless (equal command (eval compile-command)) (setq compile-command command)) (save-some-buffers (not compilation-ask-about-save) nil) (compile-internal command "No more errors")) ;; run compile with the default command line (defun recompile () "Re-compile the program including the current buffer." --- 582,614 ---- the function in `compilation-buffer-name-function', so you can set that to a function that generates a unique name." (interactive ! (if compilation-read-command (list (read-from-minibuffer "Compile command: " ! (eval compile-command) nil nil ! '(compile-history . 1))) ! (if current-prefix-arg ! (list (concat (eval compile-command) ! " " ! (or compile-default-target ""))) ! (list (eval compile-command))))) (unless (equal command (eval compile-command)) (setq compile-command command)) (save-some-buffers (not compilation-ask-about-save) nil) (compile-internal command "No more errors")) + (defun compile-default-target () + "Return the default target for `compile'." + (cond ((eq major-mode 'makefile-mode) + (save-excursion + (if (re-search-backward makefile-dependency-regex nil t) + (match-string 1)))) + (buffer-file-name ; generate an executable name: + (file-name-sans-extension (file-name-nondirectory buffer-file-name))) + (t ; see grep: + (funcall (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'grep-tag-default))))) + ;; run compile with the default command line (defun recompile () "Re-compile the program including the current buffer."