comparison lisp/packages/compile.el @ 120:cca96a509cfe r20-1b12

Import from CVS: tag r20-1b12
author cvs
date Mon, 13 Aug 2007 09:25:29 +0200
parents 9f59509498e1
children 489f57a838ef
comparison
equal deleted inserted replaced
119:d101af7320b8 120:cca96a509cfe
31 ;; This package provides the compile and grep facilities documented in 31 ;; This package provides the compile and grep facilities documented in
32 ;; the Emacs user's manual. 32 ;; the Emacs user's manual.
33 33
34 ;;; Code: 34 ;;; Code:
35 35
36 (defgroup compilation nil
37 "Compilation buffer processing"
38 :group 'programming)
39
40
36 ;;;###autoload 41 ;;;###autoload
37 (defvar compilation-mode-hook nil 42 (defcustom compilation-mode-hook nil
38 "*List of hook functions run by `compilation-mode' (see `run-hooks').") 43 "*List of hook functions run by `compilation-mode' (see `run-hooks')."
44 :type 'hook
45 :group 'compilation)
39 46
40 ;;;###autoload 47 ;;;###autoload
41 (defvar compilation-window-height nil 48 (defcustom compilation-window-height nil
42 "*Number of lines in a compilation window. If nil, use Emacs default.") 49 "*Number of lines in a compilation window. If nil, use Emacs default."
50 :type '(choice (const nil)
51 integer)
52 :group 'compilation)
43 53
44 ;; XEmacs change 54 ;; XEmacs change
45 (defvar compilation-error-list 'invalid ; only valid buffer-local 55 (defvar compilation-error-list 'invalid ; only valid buffer-local
46 "List of error message descriptors for visiting erring functions. 56 "List of error message descriptors for visiting erring functions.
47 Each error descriptor is a cons (or nil). Its car is a marker pointing to 57 Each error descriptor is a cons (or nil). Its car is a marker pointing to
70 It should read in the source files which have errors and set 80 It should read in the source files which have errors and set
71 `compilation-error-list' to a list with an element for each error message 81 `compilation-error-list' to a list with an element for each error message
72 found. See that variable for more info.") 82 found. See that variable for more info.")
73 83
74 ;;;###autoload 84 ;;;###autoload
75 (defvar compilation-buffer-name-function nil 85 (defcustom compilation-buffer-name-function nil
76 "Function to compute the name of a compilation buffer. 86 "Function to compute the name of a compilation buffer.
77 The function receives one argument, the name of the major mode of the 87 The function receives one argument, the name of the major mode of the
78 compilation buffer. It should return a string. 88 compilation buffer. It should return a string.
79 nil means compute the name with `(concat \"*\" (downcase major-mode) \"*\")'.") 89 nil means compute the name with `(concat \"*\" (downcase major-mode) \"*\")'."
90 :type 'function
91 :group 'compilation)
80 92
81 ;;;###autoload 93 ;;;###autoload
82 (defvar compilation-finish-function nil 94 (defcustom compilation-finish-function nil
83 "*Function to call when a compilation process finishes. 95 "*Function to call when a compilation process finishes.
84 It is called with two arguments: the compilation buffer, and a string 96 It is called with two arguments: the compilation buffer, and a string
85 describing how the process finished.") 97 describing how the process finished."
98 :type 'function
99 :group 'compilation)
86 100
87 (defvar compilation-last-buffer nil 101 (defvar compilation-last-buffer nil
88 "The most recent compilation buffer. 102 "The most recent compilation buffer.
89 A buffer becomes most recent when its compilation is started 103 A buffer becomes most recent when its compilation is started
90 or when it is used with \\[next-error] or \\[compile-goto-error].") 104 or when it is used with \\[next-error] or \\[compile-goto-error].")
94 (or (assq 'compilation-in-progress minor-mode-alist) 108 (or (assq 'compilation-in-progress minor-mode-alist)
95 (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") 109 (setq minor-mode-alist (cons '(compilation-in-progress " Compiling")
96 minor-mode-alist))) 110 minor-mode-alist)))
97 111
98 ;; XEmacs change 112 ;; XEmacs change
99 (defvar compilation-always-signal-completion nil 113 (defcustom compilation-always-signal-completion nil
100 "Always give an audible signal upon compilation completion. 114 "*Always give an audible signal upon compilation completion.
101 By default that signal is only given if the bottom of the compilation 115 By default that signal is only given if the bottom of the compilation
102 buffer is not visible in its window.") 116 buffer is not visible in its window."
117 :type 'boolean
118 :group 'compilation)
103 119
104 (defvar compilation-parsing-end nil 120 (defvar compilation-parsing-end nil
105 "Position of end of buffer when last error messages were parsed.") 121 "Position of end of buffer when last error messages were parsed.")
106 122
107 (defvar compilation-error-message "No more errors" 123 (defvar compilation-error-message "No more errors"
108 "Message to print when no more matches are found.") 124 "Message to print when no more matches are found.")
109 125
110 (defvar compilation-num-errors-found) 126 (defvar compilation-num-errors-found)
111 127
112 (defvar compilation-error-regexp-systems-list 'all 128 (defcustom compilation-error-regexp-systems-list 'all
113 "This is either the symbol `all', or a list of systems for which 129 "*This is either the symbol `all', or a list of systems for which
114 compilation error regexps should be included in 130 compilation error regexps should be included in
115 `compilation-error-regexp-alist'. 131 `compilation-error-regexp-alist'.
116 132
117 The list of known systems is: 133 The list of known systems is:
118 gnu: but of course 134 gnu: but of course
128 cray: Using Cray 144 cray: Using Cray
129 ibm: IBM C compilers 145 ibm: IBM C compilers
130 aix: the operating system 146 aix: the operating system
131 ultrix: the operating system 147 ultrix: the operating system
132 148
133 See also the variable `compilation-error-regexp-alist-alist'.") 149 See also the variable `compilation-error-regexp-alist-alist'."
150 :type '(choice (const all) (repeat symbol))
151 :group 'compilation)
134 152
135 (defun compilation-build-compilation-error-regexp-alist () 153 (defun compilation-build-compilation-error-regexp-alist ()
136 (interactive) 154 (interactive)
137 (setq compilation-error-regexp-alist 155 (setq compilation-error-regexp-alist
138 (apply 'append 156 (apply 'append
331 `compilation-build-compilation-error-regexp-alist' using the 349 `compilation-build-compilation-error-regexp-alist' using the
332 value of the variable `compilation-error-regexp-alist-alist'") 350 value of the variable `compilation-error-regexp-alist-alist'")
333 351
334 (compilation-build-compilation-error-regexp-alist) 352 (compilation-build-compilation-error-regexp-alist)
335 353
336 (defvar compilation-read-command t 354 (defcustom compilation-read-command t
337 "If not nil, M-x compile reads the compilation command to use. 355 "*If not nil, M-x compile reads the compilation command to use.
338 Otherwise, M-x compile just uses the value of `compile-command'.") 356 Otherwise, M-x compile just uses the value of `compile-command'."
339 357 :type 'boolean
340 (defvar compilation-ask-about-save t 358 :group 'compilation)
341 "If not nil, M-x compile asks which buffers to save before compiling. 359
342 Otherwise, it saves all modified buffers without asking.") 360 (defcustom compilation-ask-about-save t
361 "*If not nil, M-x compile asks which buffers to save before compiling.
362 Otherwise, it saves all modified buffers without asking."
363 :type 'boolean
364 :group 'compilation)
343 365
344 (defvar grep-regexp-alist 366 (defvar grep-regexp-alist
345 '(("^\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)) 367 '(("^\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2))
346 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") 368 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.")
347 369
348 (defvar grep-command "grep -n " 370 (defcustom grep-command "grep -n "
349 "Last grep command used in \\[grep]; default for next grep.") 371 "*Last grep command used in \\[grep]; default for next grep."
372 :type 'string
373 :group 'compilation)
350 374
351 ;;;###autoload 375 ;;;###autoload
352 (defvar compilation-search-path '(nil) 376 (defcustom compilation-search-path '(nil)
353 "*List of directories to search for source files named in error messages. 377 "*List of directories to search for source files named in error messages.
354 Elements should be directory names, not file names of directories. 378 Elements should be directory names, not file names of directories.
355 nil as an element means to try the default directory.") 379 nil as an element means to try the default directory."
356 380 :type '(repeat (choice (const :tag "Default" nil)
357 (defvar compile-command "make -k " 381 directory))
358 "Last shell command used to do a compilation; default for next compilation. 382 :group 'compilation)
383
384 (defcustom compile-command "make -k "
385 "*Last shell command used to do a compilation; default for next compilation.
359 386
360 Sometimes it is useful for files to supply local values for this variable. 387 Sometimes it is useful for files to supply local values for this variable.
361 You might also use mode hooks to specify it in certain modes, like this: 388 You might also use mode hooks to specify it in certain modes, like this:
362 389
363 (setq c-mode-hook 390 (setq c-mode-hook
364 '(lambda () (or (file-exists-p \"makefile\") (file-exists-p \"Makefile\") 391 '(lambda () (or (file-exists-p \"makefile\") (file-exists-p \"Makefile\")
365 (progn (make-local-variable 'compile-command) 392 (progn (make-local-variable 'compile-command)
366 (setq compile-command 393 (setq compile-command
367 (concat \"make -k \" 394 (concat \"make -k \"
368 buffer-file-name))))))") 395 buffer-file-name))))))"
396 :type 'string
397 :group 'compilation)
369 398
370 (defvar compilation-enter-directory-regexp 399 (defvar compilation-enter-directory-regexp
371 "[^\n]*: Entering directory `\\([^\n]*\\)'$" 400 "[^\n]*: Entering directory `\\([^\n]*\\)'$"
372 "Regular expression matching lines that indicate a new current directory. 401 "Regular expression matching lines that indicate a new current directory.
373 This must contain one \\(, \\) pair around the directory name. 402 This must contain one \\(, \\) pair around the directory name.
419 448
420 ;; XEmacs change 449 ;; XEmacs change
421 (put 'compilation-mode 'font-lock-defaults 450 (put 'compilation-mode 'font-lock-defaults
422 '(compilation-font-lock-keywords t)) 451 '(compilation-font-lock-keywords t))
423 452
424 (defvar compilation-mouse-motion-initiate-parsing t 453 (defcustom compilation-mouse-motion-initiate-parsing t
425 "When set to a non-nil value, mouse motion over the compilation/grep output 454 "*Should mouse motion over the compilation buffer initiate parsing?
426 buffer may initiate parsing of the error messages or grep hits") 455 When set to a non-nil value, mouse motion over the compilation/grep
427 456 buffer may initiate parsing of the error messages or grep hits.
457 When this is nil, errors and grep matches will no longer be
458 highlighted until they have been parsed, but may still be selected
459 with the center mouse button. This will then initiate parsing
460 and jump to the corresponding source line."
461 :type 'boolean
462 :group 'compilation)
428 463
429 ;;;###autoload 464 ;;;###autoload
430 (defun compile (command) 465 (defun compile (command)
431 "Compile the program including the current buffer. Default: run `make'. 466 "Compile the program including the current buffer. Default: run `make'.
432 Runs COMMAND, a shell command, in a separate process asynchronously 467 Runs COMMAND, a shell command, in a separate process asynchronously