aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorKaroly Lorentey2004-09-13 20:33:29 +0000
committerKaroly Lorentey2004-09-13 20:33:29 +0000
commit267eea215b322b02bc4bce13cae61813c50f4b5f (patch)
tree2dec815aa97a75c7d1589e72aa814bba68d4ade9 /lisp/progmodes
parent5cd432338667788c6739f43e4aa37fb53cc2a125 (diff)
parentef3b7aae581ae555a11aa38f13e0eb55ad93a8c7 (diff)
downloademacs-267eea215b322b02bc4bce13cae61813c50f4b5f.tar.gz
emacs-267eea215b322b02bc4bce13cae61813c50f4b5f.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-537 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-538 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-540 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-541 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-542 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-543 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-544 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-545 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-546 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-21 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-22 Update from CVS: lisp/nndb.el (require): Remove tcp and duplicate cl. * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-23 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-24 lisp/nnimap.el (nnimap-open-connection): Remove extraneous end-paren * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-25 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-26 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-244
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/compile.el53
1 files changed, 29 insertions, 24 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 8ae2a7abe76..2f910608d5c 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -849,6 +849,7 @@ Otherwise, construct a buffer name from MODE-NAME."
849 849
850(defun compilation-start (command &optional mode name-function highlight-regexp) 850(defun compilation-start (command &optional mode name-function highlight-regexp)
851 "Run compilation command COMMAND (low level interface). 851 "Run compilation command COMMAND (low level interface).
852If COMMAND starts with a cd command, that becomes the `default-directory'.
852The rest of the arguments are optional; for them, nil means use the default. 853The rest of the arguments are optional; for them, nil means use the default.
853 854
854MODE is the major mode to set in the compilation buffer. Mode 855MODE is the major mode to set in the compilation buffer. Mode
@@ -861,26 +862,29 @@ global value of `compilation-highlight-regexp'.
861 862
862Returns the compilation buffer created." 863Returns the compilation buffer created."
863 (or mode (setq mode 'compilation-mode)) 864 (or mode (setq mode 'compilation-mode))
864 (let ((name-of-mode 865 (let* ((name-of-mode
865 (if (eq mode t) 866 (if (eq mode t)
866 (prog1 "compilation" (require 'comint)) 867 (prog1 "compilation" (require 'comint))
867 (replace-regexp-in-string "-mode$" "" (symbol-name mode)))) 868 (replace-regexp-in-string "-mode$" "" (symbol-name mode))))
868 (process-environment 869 (process-environment
869 (append 870 (append
870 compilation-environment 871 compilation-environment
871 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning 872 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
872 system-uses-terminfo) 873 system-uses-terminfo)
873 (list "TERM=dumb" "TERMCAP=" 874 (list "TERM=dumb" "TERMCAP="
874 (format "COLUMNS=%d" (window-width))) 875 (format "COLUMNS=%d" (window-width)))
875 (list "TERM=emacs" 876 (list "TERM=emacs"
876 (format "TERMCAP=emacs:co#%d:tc=unknown:" 877 (format "TERMCAP=emacs:co#%d:tc=unknown:"
877 (window-width)))) 878 (window-width))))
878 ;; Set the EMACS variable, but 879 ;; Set the EMACS variable, but
879 ;; don't override users' setting of $EMACS. 880 ;; don't override users' setting of $EMACS.
880 (unless (getenv "EMACS") '("EMACS=t")) 881 (unless (getenv "EMACS") '("EMACS=t"))
881 (copy-sequence process-environment))) 882 (copy-sequence process-environment)))
882 (thisdir default-directory) 883 cd-path ; in case process-environment contains CDPATH
883 outwin outbuf) 884 (thisdir (if (string-match "^\\s *cd\\s +\\(.+?\\)\\s *[;&\n]" command)
885 (substitute-in-file-name (match-string 1 command))
886 default-directory))
887 outwin outbuf)
884 (with-current-buffer 888 (with-current-buffer
885 (setq outbuf 889 (setq outbuf
886 (get-buffer-create 890 (get-buffer-create
@@ -901,15 +905,16 @@ Returns the compilation buffer created."
901 (buffer-name))))) 905 (buffer-name)))))
902 ;; Clear out the compilation buffer and make it writable. 906 ;; Clear out the compilation buffer and make it writable.
903 ;; Change its default-directory to the directory where the compilation 907 ;; Change its default-directory to the directory where the compilation
904 ;; will happen, and insert a `cd' command to indicate this. 908 ;; will happen, and insert a `default-directory' to indicate this.
905 (setq buffer-read-only nil) 909 (setq buffer-read-only nil)
906 (buffer-disable-undo (current-buffer)) 910 (buffer-disable-undo (current-buffer))
907 (erase-buffer) 911 (erase-buffer)
908 (buffer-enable-undo (current-buffer)) 912 (buffer-enable-undo (current-buffer))
909 (setq default-directory thisdir) 913 (cd thisdir)
910 ;; output a mode setter, for saving and later reloading this buffer 914 ;; output a mode setter, for saving and later reloading this buffer
911 (insert "cd " thisdir " # -*-" name-of-mode 915 (insert "-*- mode: " name-of-mode
912 "-*-\nEntering directory `" thisdir "'\n" command "\n") 916 "; default-directory: " (prin1-to-string default-directory)
917 " -*-\n" command "\n")
913 (set-buffer-modified-p nil)) 918 (set-buffer-modified-p nil))
914 ;; If we're already in the compilation buffer, go to the end 919 ;; If we're already in the compilation buffer, go to the end
915 ;; of the buffer, so point will track the compilation output. 920 ;; of the buffer, so point will track the compilation output.