diff options
| author | Richard M. Stallman | 2004-10-16 15:12:25 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-10-16 15:12:25 +0000 |
| commit | d42c87ab5397404b76b2f3c06bf200296a363a80 (patch) | |
| tree | 6e5f3e679f14451eeaad39cbd743e8ac4a717242 | |
| parent | 6063ae55f000925189abdb59d7cfe7c0d525189d (diff) | |
| download | emacs-d42c87ab5397404b76b2f3c06bf200296a363a80.tar.gz emacs-d42c87ab5397404b76b2f3c06bf200296a363a80.zip | |
(compilation-start): Assume compilation-mode will make the buffer read-only.
(compilation-mode): Take arg name-of-mode.
(compilation-setup): Make buffer read-only.
(compilation-handle-exit): Bind inhibit-read-only.
| -rw-r--r-- | lisp/progmodes/compile.el | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 2f910608d5c..a3aa70a8a8d 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -903,18 +903,18 @@ Returns the compilation buffer created." | |||
| 903 | (error nil)) | 903 | (error nil)) |
| 904 | (error "Cannot have two processes in `%s' at once" | 904 | (error "Cannot have two processes in `%s' at once" |
| 905 | (buffer-name))))) | 905 | (buffer-name))))) |
| 906 | ;; Clear out the compilation buffer and make it writable. | ||
| 907 | ;; Change its default-directory to the directory where the compilation | ||
| 908 | ;; will happen, and insert a `default-directory' to indicate this. | ||
| 909 | (setq buffer-read-only nil) | ||
| 910 | (buffer-disable-undo (current-buffer)) | 906 | (buffer-disable-undo (current-buffer)) |
| 911 | (erase-buffer) | 907 | ;; Make compilation buffer read-only. The filter can still write it. |
| 912 | (buffer-enable-undo (current-buffer)) | 908 | ;; Clear out the compilation buffer. |
| 913 | (cd thisdir) | 909 | (let ((inhibit-read-only t)) |
| 914 | ;; output a mode setter, for saving and later reloading this buffer | 910 | (erase-buffer) |
| 915 | (insert "-*- mode: " name-of-mode | 911 | ;; Change its default-directory to the directory where the compilation |
| 916 | "; default-directory: " (prin1-to-string default-directory) | 912 | ;; will happen, and insert a `cd' command to indicate this. |
| 917 | " -*-\n" command "\n") | 913 | (setq default-directory thisdir) |
| 914 | ;; output a mode setter, for saving and later reloading this buffer | ||
| 915 | (insert "-*- mode: " name-of-mode | ||
| 916 | "; default-directory: " (prin1-to-string default-directory) | ||
| 917 | " -*-\n" command "\n")) | ||
| 918 | (set-buffer-modified-p nil)) | 918 | (set-buffer-modified-p nil)) |
| 919 | ;; 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 |
| 920 | ;; of the buffer, so point will track the compilation output. | 920 | ;; of the buffer, so point will track the compilation output. |
| @@ -925,10 +925,9 @@ Returns the compilation buffer created." | |||
| 925 | (with-current-buffer outbuf | 925 | (with-current-buffer outbuf |
| 926 | (if (not (eq mode t)) | 926 | (if (not (eq mode t)) |
| 927 | (funcall mode) | 927 | (funcall mode) |
| 928 | (setq buffer-read-only nil) | ||
| 928 | (with-no-warnings (comint-mode)) | 929 | (with-no-warnings (comint-mode)) |
| 929 | (compilation-shell-minor-mode)) | 930 | (compilation-shell-minor-mode)) |
| 930 | ;; In what way is it non-ergonomic ? -stef | ||
| 931 | ;; (toggle-read-only 1) ;;; Non-ergonomic. | ||
| 932 | (if highlight-regexp | 931 | (if highlight-regexp |
| 933 | (set (make-local-variable 'compilation-highlight-regexp) | 932 | (set (make-local-variable 'compilation-highlight-regexp) |
| 934 | highlight-regexp)) | 933 | highlight-regexp)) |
| @@ -1108,7 +1107,7 @@ from a different message." | |||
| 1108 | :version "21.4") | 1107 | :version "21.4") |
| 1109 | 1108 | ||
| 1110 | ;;;###autoload | 1109 | ;;;###autoload |
| 1111 | (defun compilation-mode () | 1110 | (defun compilation-mode (&optional name-of-mode) |
| 1112 | "Major mode for compilation log buffers. | 1111 | "Major mode for compilation log buffers. |
| 1113 | \\<compilation-mode-map>To visit the source for a line-numbered error, | 1112 | \\<compilation-mode-map>To visit the source for a line-numbered error, |
| 1114 | move point to the error message line and type \\[compile-goto-error]. | 1113 | move point to the error message line and type \\[compile-goto-error]. |
| @@ -1121,7 +1120,7 @@ Runs `compilation-mode-hook' with `run-hooks' (which see). | |||
| 1121 | (kill-all-local-variables) | 1120 | (kill-all-local-variables) |
| 1122 | (use-local-map compilation-mode-map) | 1121 | (use-local-map compilation-mode-map) |
| 1123 | (setq major-mode 'compilation-mode | 1122 | (setq major-mode 'compilation-mode |
| 1124 | mode-name "Compilation") | 1123 | mode-name (or name-of-mode "Compilation")) |
| 1125 | (set (make-local-variable 'page-delimiter) | 1124 | (set (make-local-variable 'page-delimiter) |
| 1126 | compilation-page-delimiter) | 1125 | compilation-page-delimiter) |
| 1127 | (compilation-setup) | 1126 | (compilation-setup) |
| @@ -1187,6 +1186,7 @@ If nil, use the beginning of buffer.") | |||
| 1187 | "Prepare the buffer for the compilation parsing commands to work. | 1186 | "Prepare the buffer for the compilation parsing commands to work. |
| 1188 | Optional argument MINOR indicates this is called from | 1187 | Optional argument MINOR indicates this is called from |
| 1189 | `compilation-minor-mode'." | 1188 | `compilation-minor-mode'." |
| 1189 | (setq buffer-read-only t) | ||
| 1190 | (make-local-variable 'compilation-current-error) | 1190 | (make-local-variable 'compilation-current-error) |
| 1191 | (make-local-variable 'compilation-messages-start) | 1191 | (make-local-variable 'compilation-messages-start) |
| 1192 | (make-local-variable 'compilation-error-screen-columns) | 1192 | (make-local-variable 'compilation-error-screen-columns) |
| @@ -1248,7 +1248,7 @@ Turning the mode on runs the normal hook `compilation-minor-mode-hook'." | |||
| 1248 | 1248 | ||
| 1249 | (defun compilation-handle-exit (process-status exit-status msg) | 1249 | (defun compilation-handle-exit (process-status exit-status msg) |
| 1250 | "Write MSG in the current buffer and hack its mode-line-process." | 1250 | "Write MSG in the current buffer and hack its mode-line-process." |
| 1251 | (let ((buffer-read-only nil) | 1251 | (let ((inhibit-read-only t) |
| 1252 | (status (if compilation-exit-message-function | 1252 | (status (if compilation-exit-message-function |
| 1253 | (funcall compilation-exit-message-function | 1253 | (funcall compilation-exit-message-function |
| 1254 | process-status exit-status msg) | 1254 | process-status exit-status msg) |