Mercurial > emacs
comparison lisp/progmodes/compile.el @ 21930:b84bfe98263d
* progmodes/compile.el (compilation-directory-stack): Doc fix.
(compilation-mode): Accept optional parameter and initialize
mode-name from it.
(compile-internal): Pass name-of-mode to compilation-mode. Don't
set mode-name here.
(compilation-minor-mode): Don't let mode-line-process change.
(compilation-next-error-locus): Use forward-char instead of
move-to-column.
(compilation-parse-errors): Set default-directory from head of
compilation-directory-stack.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Mon, 04 May 1998 08:35:40 +0000 |
parents | 1581abe1a67e |
children | 5b05d45bfbbf |
comparison
equal
deleted
inserted
replaced
21929:5be79e4f188a | 21930:b84bfe98263d |
---|---|
448 :type 'string | 448 :type 'string |
449 :group 'compilation) | 449 :group 'compilation) |
450 | 450 |
451 (defvar compilation-directory-stack nil | 451 (defvar compilation-directory-stack nil |
452 "Stack of previous directories for `compilation-leave-directory-regexp'. | 452 "Stack of previous directories for `compilation-leave-directory-regexp'. |
453 The head element is the directory the compilation was started in.") | 453 The last element is the directory the compilation was started in.") |
454 | 454 |
455 (defvar compilation-exit-message-function nil "\ | 455 (defvar compilation-exit-message-function nil "\ |
456 If non-nil, called when a compilation process dies to return a status message. | 456 If non-nil, called when a compilation process dies to return a status message. |
457 This should be a function of three arguments: process status, exit status, | 457 This should be a function of three arguments: process status, exit status, |
458 and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to | 458 and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to |
676 (goto-char (point-max))) | 676 (goto-char (point-max))) |
677 ;; Pop up the compilation buffer. | 677 ;; Pop up the compilation buffer. |
678 (setq outwin (display-buffer outbuf)) | 678 (setq outwin (display-buffer outbuf)) |
679 (save-excursion | 679 (save-excursion |
680 (set-buffer outbuf) | 680 (set-buffer outbuf) |
681 (compilation-mode) | 681 (compilation-mode name-of-mode) |
682 ;; (setq buffer-read-only t) ;;; Non-ergonomic. | 682 ;; (setq buffer-read-only t) ;;; Non-ergonomic. |
683 (set (make-local-variable 'compilation-parse-errors-function) parser) | 683 (set (make-local-variable 'compilation-parse-errors-function) parser) |
684 (set (make-local-variable 'compilation-error-message) error-message) | 684 (set (make-local-variable 'compilation-error-message) error-message) |
685 (set (make-local-variable 'compilation-error-regexp-alist) | 685 (set (make-local-variable 'compilation-error-regexp-alist) |
686 error-regexp-alist) | 686 error-regexp-alist) |
703 ;; with lazy-lock on. | 703 ;; with lazy-lock on. |
704 (setq lazy-lock-defer-on-scrolling t) | 704 (setq lazy-lock-defer-on-scrolling t) |
705 (setq default-directory thisdir | 705 (setq default-directory thisdir |
706 compilation-directory-stack (list default-directory)) | 706 compilation-directory-stack (list default-directory)) |
707 (set-window-start outwin (point-min)) | 707 (set-window-start outwin (point-min)) |
708 (setq mode-name name-of-mode) | |
709 (or (eq outwin (selected-window)) | 708 (or (eq outwin (selected-window)) |
710 (set-window-point outwin (point-min))) | 709 (set-window-point outwin (point-min))) |
711 (compilation-set-window-height outwin) | 710 (compilation-set-window-height outwin) |
712 (if compilation-process-setup-function | 711 (if compilation-process-setup-function |
713 (funcall compilation-process-setup-function)) | 712 (funcall compilation-process-setup-function)) |
837 `compilation-minor-mode-map' is a cdr of this.") | 836 `compilation-minor-mode-map' is a cdr of this.") |
838 | 837 |
839 (put 'compilation-mode 'mode-class 'special) | 838 (put 'compilation-mode 'mode-class 'special) |
840 | 839 |
841 ;;;###autoload | 840 ;;;###autoload |
842 (defun compilation-mode () | 841 (defun compilation-mode (&optional name-of-mode) |
843 "Major mode for compilation log buffers. | 842 "Major mode for compilation log buffers. |
844 \\<compilation-mode-map>To visit the source for a line-numbered error, | 843 \\<compilation-mode-map>To visit the source for a line-numbered error, |
845 move point to the error message line and type \\[compile-goto-error]. | 844 move point to the error message line and type \\[compile-goto-error]. |
846 To kill the compilation, type \\[kill-compilation]. | 845 To kill the compilation, type \\[kill-compilation]. |
847 | 846 |
848 Runs `compilation-mode-hook' with `run-hooks' (which see)." | 847 Runs `compilation-mode-hook' with `run-hooks' (which see)." |
849 (interactive) | 848 (interactive) |
850 (kill-all-local-variables) | 849 (kill-all-local-variables) |
851 (use-local-map compilation-mode-map) | 850 (use-local-map compilation-mode-map) |
852 (setq major-mode 'compilation-mode | 851 (setq major-mode 'compilation-mode |
853 mode-name "Compilation") | 852 mode-name (or name-of-mode "Compilation")) |
854 (compilation-setup) | 853 (compilation-setup) |
855 (set (make-local-variable 'font-lock-defaults) | 854 (set (make-local-variable 'font-lock-defaults) |
856 '(compilation-mode-font-lock-keywords t)) | 855 '(compilation-mode-font-lock-keywords t)) |
857 (set (make-local-variable 'revert-buffer-function) | 856 (set (make-local-variable 'revert-buffer-function) |
858 'compilation-revert-buffer) | 857 'compilation-revert-buffer) |
910 Turning the mode on runs the normal hook `compilation-minor-mode-hook'." | 909 Turning the mode on runs the normal hook `compilation-minor-mode-hook'." |
911 (interactive "P") | 910 (interactive "P") |
912 (if (setq compilation-minor-mode (if (null arg) | 911 (if (setq compilation-minor-mode (if (null arg) |
913 (null compilation-minor-mode) | 912 (null compilation-minor-mode) |
914 (> (prefix-numeric-value arg) 0))) | 913 (> (prefix-numeric-value arg) 0))) |
915 (progn | 914 (let ((mode-line-process)) |
916 (compilation-setup) | 915 (compilation-setup) |
917 (run-hooks 'compilation-minor-mode-hook)))) | 916 (run-hooks 'compilation-minor-mode-hook)))) |
918 | 917 |
919 ;; Write msg in the current buffer and hack its mode-line-process. | 918 ;; Write msg in the current buffer and hack its mode-line-process. |
920 (defun compilation-handle-exit (process-status exit-status msg) | 919 (defun compilation-handle-exit (process-status exit-status msg) |
1439 (save-restriction | 1438 (save-restriction |
1440 (widen) | 1439 (widen) |
1441 (goto-line last-line) | 1440 (goto-line last-line) |
1442 (if (and column (> column 0)) | 1441 (if (and column (> column 0)) |
1443 ;; Columns in error msgs are 1-origin. | 1442 ;; Columns in error msgs are 1-origin. |
1444 (move-to-column (1- column)) | 1443 (forward-char (1- column)) |
1445 (beginning-of-line)) | 1444 (beginning-of-line)) |
1446 (setcdr next-error (point-marker)) | 1445 (setcdr next-error (point-marker)) |
1447 ;; Make all the other error messages referring | 1446 ;; Make all the other error messages referring |
1448 ;; to the same file have markers into the buffer. | 1447 ;; to the same file have markers into the buffer. |
1449 (while errors | 1448 (while errors |
1463 (re-search-forward "[\n\C-m]" | 1462 (re-search-forward "[\n\C-m]" |
1464 nil 'end | 1463 nil 'end |
1465 lines)) | 1464 lines)) |
1466 (forward-line lines)) | 1465 (forward-line lines)) |
1467 (if (and column (> column 1)) | 1466 (if (and column (> column 1)) |
1468 (move-to-column (1- column)) | 1467 (forward-char (1- column)) |
1469 (beginning-of-line)) | 1468 (beginning-of-line)) |
1470 (setq last-line this) | 1469 (setq last-line this) |
1471 (setcdr (car errors) (point-marker)))) | 1470 (setcdr (car errors) (point-marker)))) |
1472 (setq errors (cdr errors))))))))) | 1471 (setq errors (cdr errors))))))))) |
1473 ;; If we didn't get a marker for this error, or this | 1472 ;; If we didn't get a marker for this error, or this |
1622 (setq compilation-error-list nil) | 1621 (setq compilation-error-list nil) |
1623 (message "Parsing error messages...") | 1622 (message "Parsing error messages...") |
1624 (if (null compilation-error-regexp-alist) | 1623 (if (null compilation-error-regexp-alist) |
1625 (error "compilation-error-regexp-alist is empty!")) | 1624 (error "compilation-error-regexp-alist is empty!")) |
1626 (let* ((compilation-regexps nil) ; Variable set by compile-collect-regexps. | 1625 (let* ((compilation-regexps nil) ; Variable set by compile-collect-regexps. |
1627 (default-directory default-directory) | 1626 (default-directory (car compilation-directory-stack)) |
1628 (found-desired nil) | 1627 (found-desired nil) |
1629 (compilation-num-errors-found 0) | 1628 (compilation-num-errors-found 0) |
1630 ;; Set up now the expanded, abbreviated directory variables | 1629 ;; Set up now the expanded, abbreviated directory variables |
1631 ;; that compile-abbreviate-directory will need, so we can | 1630 ;; that compile-abbreviate-directory will need, so we can |
1632 ;; compute them just once here. | 1631 ;; compute them just once here. |