/[emacs]/emacs/lisp/progmodes/compile.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/compile.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.276.2.5 by miles, Thu Sep 9 09:36:33 2004 UTC revision 1.276.2.6 by miles, Wed Sep 15 08:59:57 2004 UTC
# Line 849  Otherwise, construct a buffer name from Line 849  Otherwise, construct a buffer name from
849    
850  (defun compilation-start (command &optional mode name-function highlight-regexp)  (defun compilation-start (command &optional mode name-function highlight-regexp)
851    "Run compilation command COMMAND (low level interface).    "Run compilation command COMMAND (low level interface).
852    If COMMAND starts with a cd command, that becomes the `default-directory'.
853  The rest of the arguments are optional; for them, nil means use the default.  The rest of the arguments are optional; for them, nil means use the default.
854    
855  MODE is the major mode to set in the compilation buffer.  Mode  MODE is the major mode to set in the compilation buffer.  Mode
# Line 861  global value of `compilation-highlight-r Line 862  global value of `compilation-highlight-r
862    
863  Returns the compilation buffer created."  Returns the compilation buffer created."
864    (or mode (setq mode 'compilation-mode))    (or mode (setq mode 'compilation-mode))
865    (let ((name-of-mode    (let* ((name-of-mode
866           (if (eq mode t)            (if (eq mode t)
867               (prog1 "compilation" (require 'comint))                (prog1 "compilation" (require 'comint))
868             (replace-regexp-in-string "-mode$" "" (symbol-name mode))))              (replace-regexp-in-string "-mode$" "" (symbol-name mode))))
869          (process-environment           (process-environment
870           (append            (append
871            compilation-environment             compilation-environment
872            (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning             (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
873                    system-uses-terminfo)                     system-uses-terminfo)
874                (list "TERM=dumb" "TERMCAP="                 (list "TERM=dumb" "TERMCAP="
875                      (format "COLUMNS=%d" (window-width)))                       (format "COLUMNS=%d" (window-width)))
876              (list "TERM=emacs"               (list "TERM=emacs"
877                    (format "TERMCAP=emacs:co#%d:tc=unknown:"                     (format "TERMCAP=emacs:co#%d:tc=unknown:"
878                            (window-width))))                             (window-width))))
879            ;; Set the EMACS variable, but             ;; Set the EMACS variable, but
880            ;; don't override users' setting of $EMACS.             ;; don't override users' setting of $EMACS.
881            (unless (getenv "EMACS") '("EMACS=t"))             (unless (getenv "EMACS") '("EMACS=t"))
882            (copy-sequence process-environment)))             (copy-sequence process-environment)))
883          (thisdir default-directory)           cd-path                 ; in case process-environment contains CDPATH
884          outwin outbuf)           (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)
888      (with-current-buffer      (with-current-buffer
889          (setq outbuf          (setq outbuf
890                (get-buffer-create                (get-buffer-create
# Line 901  Returns the compilation buffer created." Line 905  Returns the compilation buffer created."
905                       (buffer-name)))))                       (buffer-name)))))
906        ;; Clear out the compilation buffer and make it writable.        ;; Clear out the compilation buffer and make it writable.
907        ;; Change its default-directory to the directory where the compilation        ;; Change its default-directory to the directory where the compilation
908        ;; will happen, and insert a `cd' command to indicate this.        ;; will happen, and insert a `default-directory' to indicate this.
909        (setq buffer-read-only nil)        (setq buffer-read-only nil)
910        (buffer-disable-undo (current-buffer))        (buffer-disable-undo (current-buffer))
911        (erase-buffer)        (erase-buffer)
912        (buffer-enable-undo (current-buffer))        (buffer-enable-undo (current-buffer))
913        (setq default-directory thisdir)        (cd thisdir)
914        ;; output a mode setter, for saving and later reloading this buffer        ;; output a mode setter, for saving and later reloading this buffer
915        (insert "cd " thisdir "   # -*-" name-of-mode        (insert "-*- mode: " name-of-mode
916                "-*-\nEntering directory `" thisdir "'\n" command "\n")                "; default-directory: " (prin1-to-string default-directory)
917                  " -*-\n" command "\n")
918        (set-buffer-modified-p nil))        (set-buffer-modified-p nil))
919      ;; If we're already in the compilation buffer, go to the end      ;; If we're already in the compilation buffer, go to the end
920      ;; of the buffer, so point will track the compilation output.      ;; of the buffer, so point will track the compilation output.

Legend:
Removed from v.1.276.2.5  
changed lines
  Added in v.1.276.2.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26