diff options
Diffstat (limited to 'lisp/progmodes/compile.el')
-rw-r--r-- | lisp/progmodes/compile.el | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 68a83b47174..d6f136ec92d 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -42,24 +42,21 @@ ;;;###autoload (defcustom compilation-mode-hook nil - "List of hook functions run by `compilation-mode' (see `run-mode-hooks')." + "List of hook functions run by `compilation-mode'." :type 'hook :group 'compilation) ;;;###autoload (defcustom compilation-start-hook nil - "List of hook functions run by `compilation-start' on the compilation process. -\(See `run-hook-with-args'). -If you use \"omake -P\" and do not want \\[save-buffers-kill-terminal] to ask whether you want -the compilation to be killed, you can use this hook: - (add-hook 'compilation-start-hook - (lambda (process) (set-process-query-on-exit-flag process nil)) nil t)" + "Hook run after starting a new compilation process. +The hook is run with one argument, the new process." :type 'hook :group 'compilation) ;;;###autoload (defcustom compilation-window-height nil - "Number of lines in a compilation window. If nil, use Emacs default." + "Number of lines in a compilation window. +If nil, use Emacs default." :type '(choice (const :tag "Default" nil) integer) :group 'compilation) @@ -134,6 +131,7 @@ and a string describing how the process finished.") ;; If you make any changes to `compilation-error-regexp-alist-alist', ;; be sure to run the ERT test in test/automated/compile-tests.el. +;; emacs -batch -l compile-tests.el -f ert-run-tests-batch-and-exit (defvar compilation-error-regexp-alist-alist '((absoft @@ -261,11 +259,12 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) ;; The "in \\|from " exception was added to handle messages from Ruby. "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\|[ \t]+\\(?:in \\|from \\)\\)?\ \\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\): ?\ -\\([0-9]+\\)\\(?:[.:]\\([0-9]+\\)\\)?\ -\\(?:-\\([0-9]+\\)?\\(?:\\.\\([0-9]+\\)\\)?\\)?:\ +\\([0-9]+\\)\\(?:-\\(?4:[0-9]+\\)\\(?:\\.\\(?5:[0-9]+\\)\\)?\ +\\|[.:]\\(?3:[0-9]+\\)\\(?:-\\(?:\\(?4:[0-9]+\\)\\.\\)?\\(?5:[0-9]+\\)\\)?\\)?:\ \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ - *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\|[Nn]ote\\)\\|\ - *[Ee]rror\\|\[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)" + *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|\\[ skipping .+ \\]\\|\ +\\(?:instantiated\\|required\\) from\\|[Nn]ote\\)\\|\ + *[Ee]rror\\|[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)" 1 (2 . 4) (3 . 5) (6 . 7)) (lcc @@ -1427,8 +1426,9 @@ and move to the source code that caused it. If optional second arg COMINT is t the buffer will be in Comint mode with `compilation-shell-minor-mode'. -Interactively, prompts for the command if `compilation-read-command' is -non-nil; otherwise uses `compile-command'. With prefix arg, always prompts. +Interactively, prompts for the command if the variable +`compilation-read-command' is non-nil; otherwise uses`compile-command'. +With prefix arg, always prompts. Additionally, with universal prefix arg, compilation buffer will be in comint mode, i.e. interactive. @@ -1611,7 +1611,11 @@ Returns the compilation buffer created." (format "%s started at %s\n\n" mode-name (substring (current-time-string) 0 19)) - command "\n") + ;; The command could be split into several lines, see + ;; `rgrep' for example. We want to display it as one + ;; line. + (apply 'concat (split-string command (regexp-quote "\\\n") t)) + "\n") (setq thisdir default-directory)) (set-buffer-modified-p nil)) ;; Pop up the compilation buffer. @@ -1810,6 +1814,7 @@ Returns the compilation buffer created." (define-key map [follow-link] 'mouse-face) (define-key map "\C-c\C-c" 'compile-goto-error) (define-key map "\C-m" 'compile-goto-error) + (define-key map "\C-o" 'compilation-display-error) (define-key map "\C-c\C-k" 'kill-compilation) (define-key map "\M-n" 'compilation-next-error) (define-key map "\M-p" 'compilation-previous-error) @@ -1854,6 +1859,7 @@ Returns the compilation buffer created." (define-key map [follow-link] 'mouse-face) (define-key map "\C-c\C-c" 'compile-goto-error) (define-key map "\C-m" 'compile-goto-error) + (define-key map "\C-o" 'compilation-display-error) (define-key map "\C-c\C-k" 'kill-compilation) (define-key map "\M-n" 'compilation-next-error) (define-key map "\M-p" 'compilation-previous-error) @@ -2295,6 +2301,12 @@ Prefix arg N says how many files to move backwards (or forwards, if negative)." (interactive "p") (compilation-next-file (- n))) +(defun compilation-display-error () + "Display the source for current error in another window." + (interactive) + (setq compilation-current-error (point)) + (next-error-no-select 0)) + (defun kill-compilation () "Kill the process made by the \\[compile] or \\[grep] commands." (interactive) @@ -2370,10 +2382,12 @@ This is the value of `next-error-function' in Compilation buffers." ;; (setq timestamp compilation-buffer-modtime))) ) (with-current-buffer - (compilation-find-file - marker - (caar (compilation--loc->file-struct loc)) - (cadr (car (compilation--loc->file-struct loc)))) + (apply #'compilation-find-file + marker + (caar (compilation--loc->file-struct loc)) + (cadr (car (compilation--loc->file-struct loc))) + (compilation--file-struct->formats + (compilation--loc->file-struct loc))) (let ((screen-columns ;; Obey the compilation-error-screen-columns of the target ;; buffer if its major mode set it buffer-locally. |