aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2004-04-16 23:22:07 +0000
committerStefan Monnier2004-04-16 23:22:07 +0000
commit6f5b76274c486145d21baf6509b2a778d9fa4fdf (patch)
treef24def9a840aca6a2f10d8c10f9d1714ad341d27 /lisp
parenteb6fb6e2d5e9e3f36ba189681e0a4ea79c39c251 (diff)
downloademacs-6f5b76274c486145d21baf6509b2a778d9fa4fdf.tar.gz
emacs-6f5b76274c486145d21baf6509b2a778d9fa4fdf.zip
Doc fixes.
(compilation-error-regexp-alist-alist) (compilation-mode-font-lock-keywords): Allow non-ASCII where possible. (compilation-assq): Wrap in eval-when-compile. (compilation-mode-font-lock-keywords): Don't use list*. (compilation-start): Avoid warning. (compilation-compat-error-properties) (compilation-directory-properties): Add keymap property. (compilation-parsing-end): Make it a marker for better compatibility.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/compile.el74
1 files changed, 41 insertions, 33 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 93921fcbbe7..71946dd02f5 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -100,7 +100,7 @@ in the compilation output, and should return a transformed file name.")
100;;;###autoload 100;;;###autoload
101(defvar compilation-process-setup-function nil 101(defvar compilation-process-setup-function nil
102 "*Function to call to customize the compilation process. 102 "*Function to call to customize the compilation process.
103This functions is called immediately before the compilation process is 103This function is called immediately before the compilation process is
104started. It can be used to set any variables or functions that are used 104started. It can be used to set any variables or functions that are used
105while processing the output of the compilation process. The function 105while processing the output of the compilation process. The function
106is called with variables `compilation-buffer' and `compilation-window' 106is called with variables `compilation-buffer' and `compilation-window'
@@ -187,8 +187,9 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
187 "^\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) :\ 187 "^\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) :\
188 \\(?:warnin\\(g\\)\\|informationa\\(l\\)\\)?" 1 2 3 (4 . 5)) 188 \\(?:warnin\\(g\\)\\|informationa\\(l\\)\\)?" 1 2 3 (4 . 5))
189 189
190 ;; fixme: should be `mips'
190 (irix 191 (irix
191 "^[a-z0-9/]+: \\(?:[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\ 192 "^[-[:alnum:]_/]+: \\(?:[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\
192 \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2)) 193 \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2))
193 194
194 (java 195 (java
@@ -206,7 +207,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
206\\(.+\\):\\([0-9]+\\)\\(?:\\(:\\)\\|\\(,\\)\\)?" 1 2 nil (3 . 4)) 207\\(.+\\):\\([0-9]+\\)\\(?:\\(:\\)\\|\\(,\\)\\)?" 1 2 nil (3 . 4))
207 208
208 (gnu 209 (gnu
209 "^\\(?:[a-zA-Z][-a-zA-Z0-9.]+: ?\\)?\ 210 "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\)?\
210\\([/.]*[a-zA-Z]:?[^ \t\n:]*\\): ?\ 211\\([/.]*[a-zA-Z]:?[^ \t\n:]*\\): ?\
211\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ 212\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\
212\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\ 213\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\
@@ -228,6 +229,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
228 (1 (compilation-error-properties 2 3 nil nil nil 0 nil) 229 (1 (compilation-error-properties 2 3 nil nil nil 0 nil)
229 append))) 230 append)))
230 231
232 ;; Should be lint-1, lint-2 (SysV lint)
231 (mips-1 233 (mips-1
232 " (\\([0-9]+\\)) in \\([^ \n]+\\)" 2 1) 234 " (\\([0-9]+\\)) in \\([^ \n]+\\)" 2 1)
233 (mips-2 235 (mips-2
@@ -261,15 +263,16 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
261 nil 1 nil (3) nil (2 (compilation-face '(3)))) 263 nil 1 nil (3) nil (2 (compilation-face '(3))))
262 264
263 (sun 265 (sun
264 ": \\(?:ERROR\\|WARNIN\\(G\\)\\|REMAR\\(K\\)\\) \\(?:[a-zA-Z0-9 ]+, \\)?\ 266 ": \\(?:ERROR\\|WARNIN\\(G\\)\\|REMAR\\(K\\)\\) \\(?:[[:alnum:] ]+, \\)?\
265File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?" 267File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
266 3 4 5 (1 . 2)) 268 3 4 5 (1 . 2))
267 269
268 (sun-ada 270 (sun-ada
269 "^\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2 3) 271 "^\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2 3)
270 272
271 (ultrix 273 ;; Redundant with `mips'
272 "^\\(?:cfe\\|fort\\): \\(Warning\\)?[^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3 nil (1)) 274;; (ultrix
275;; "^\\(?:cfe\\|fort\\): \\(Warning\\)?[^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3 nil (1))
273 276
274 (4bsd 277 (4bsd
275 "\\(?:^\\|:: \\|\\S ( \\)\\(/[^ \n\t()]+\\)(\\([0-9]+\\))\ 278 "\\(?:^\\|:: \\|\\S ( \\)\\(/[^ \n\t()]+\\)(\\([0-9]+\\))\
@@ -279,14 +282,14 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
279(defcustom compilation-error-regexp-alist 282(defcustom compilation-error-regexp-alist
280 (mapcar 'car compilation-error-regexp-alist-alist) 283 (mapcar 'car compilation-error-regexp-alist-alist)
281 "Alist that specifies how to match errors in compiler output. 284 "Alist that specifies how to match errors in compiler output.
282Note that on Unix exerything is a valid filename, so these 285Note that on Unix everything is a valid filename, so these
283matchers must make some common sense assumptions, which catch 286matchers must make some common sense assumptions, which catch
284normal cases. A shorter list will be lighter on resource usage. 287normal cases. A shorter list will be lighter on resource usage.
285 288
286Instead of an alist element, you can use a symbol, which is 289Instead of an alist element, you can use a symbol, which is
287looked up in `compilation-error-regexp-alist-alist'. You can see 290looked up in `compilation-error-regexp-alist-alist'. You can see
288the predefined symbols and their effects in the file 291the predefined symbols and their effects in the file
289`etc/compilation.txt' (linked below if your are customizing this). 292`etc/compilation.txt' (linked below if you are customizing this).
290 293
291Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK 294Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK
292HIGHLIGHT...]). If REGEXP matches, the FILE'th subexpression 295HIGHLIGHT...]). If REGEXP matches, the FILE'th subexpression
@@ -357,7 +360,7 @@ you may also want to change `compilation-page-delimiter'.")
357 (1 font-lock-variable-name-face) 360 (1 font-lock-variable-name-face)
358 (2 (compilation-face '(4 . 3)))) 361 (2 (compilation-face '(4 . 3))))
359 ;; Command output lines. Recognize `make[n]:' lines too. 362 ;; Command output lines. Recognize `make[n]:' lines too.
360 ("^\\([A-Za-z_0-9/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:" 363 ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
361 (1 font-lock-function-name-face) (3 compilation-line-face nil t)) 364 (1 font-lock-function-name-face) (3 compilation-line-face nil t))
362 (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1) 365 (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1)
363 ("^Compilation finished" . compilation-info-face) 366 ("^Compilation finished" . compilation-info-face)
@@ -427,7 +430,7 @@ You might also use mode hooks to specify it in certain modes, like this:
427(defvar compilation-locs ()) 430(defvar compilation-locs ())
428 431
429(defvar compilation-debug nil 432(defvar compilation-debug nil
430 "*Set this to `t' before creating a *compilation* buffer. 433 "*Set this to t before creating a *compilation* buffer.
431Then every error line will have a debug text property with the matcher that 434Then every error line will have a debug text property with the matcher that
432fit this line and the match data. Use `describe-text-properties'.") 435fit this line and the match data. Use `describe-text-properties'.")
433 436
@@ -494,7 +497,7 @@ Faces `compilation-error-face', `compilation-warning-face',
494 497
495 498
496;; Used for compatibility with the old compile.el. 499;; Used for compatibility with the old compile.el.
497(defvar compilation-parsing-end nil) 500(defvar compilation-parsing-end (make-marker))
498(defvar compilation-parse-errors-function nil) 501(defvar compilation-parse-errors-function nil)
499(defvar compilation-error-list nil) 502(defvar compilation-error-list nil)
500(defvar compilation-old-error-list nil) 503(defvar compilation-old-error-list nil)
@@ -518,6 +521,7 @@ Faces `compilation-error-face', `compilation-warning-face',
518 '(nil)) ; nil only isn't a property-change 521 '(nil)) ; nil only isn't a property-change
519 (cons (match-string-no-properties idx) dir)) 522 (cons (match-string-no-properties idx) dir))
520 mouse-face highlight 523 mouse-face highlight
524 keymap compilation-button-map
521 help-echo "mouse-2: visit current directory"))) 525 help-echo "mouse-2: visit current directory")))
522 526
523;; Data type `reverse-ordered-alist' retriever. This function retrieves the 527;; Data type `reverse-ordered-alist' retriever. This function retrieves the
@@ -528,6 +532,7 @@ Faces `compilation-error-face', `compilation-warning-face',
528;; may be nil. The other KEYs are ordered backwards so that growing line 532;; may be nil. The other KEYs are ordered backwards so that growing line
529;; numbers can be inserted in front and searching can abort after half the 533;; numbers can be inserted in front and searching can abort after half the
530;; list on average. 534;; list on average.
535(eval-when-compile ;Don't keep it at runtime if not needed.
531(defmacro compilation-assq (key alist) 536(defmacro compilation-assq (key alist)
532 `(let* ((l1 ,alist) 537 `(let* ((l1 ,alist)
533 (l2 (cdr l1))) 538 (l2 (cdr l1)))
@@ -538,7 +543,7 @@ Faces `compilation-error-face', `compilation-warning-face',
538 l2 (cdr l1))) 543 l2 (cdr l1)))
539 (if l2 (eq ,key (caar l2)))) 544 (if l2 (eq ,key (caar l2))))
540 l2 545 l2
541 (setcdr l1 (cons (list ,key) l2)))))) 546 (setcdr l1 (cons (list ,key) l2)))))))
542 547
543 548
544;; This function is the central driver, called when font-locking to gather 549;; This function is the central driver, called when font-locking to gather
@@ -691,9 +696,9 @@ Faces `compilation-error-face', `compilation-warning-face',
691 ;; error location. Let's do our best. 696 ;; error location. Let's do our best.
692 `(,(car item) 697 `(,(car item)
693 (0 (compilation-compat-error-properties 698 (0 (compilation-compat-error-properties
694 (funcall ',line (list* (match-string ,file) 699 (funcall ',line (cons (match-string ,file)
695 default-directory 700 (cons default-directory
696 ',(nthcdr 4 item)) 701 ',(nthcdr 4 item)))
697 ,(if col `(match-string ,col))))) 702 ,(if col `(match-string ,col)))))
698 (,file compilation-error-face t)) 703 (,file compilation-error-face t))
699 704
@@ -734,7 +739,7 @@ Faces `compilation-error-face', `compilation-warning-face',
734Runs COMMAND, a shell command, in a separate process asynchronously 739Runs COMMAND, a shell command, in a separate process asynchronously
735with output going to the buffer `*compilation*'. 740with output going to the buffer `*compilation*'.
736 741
737If optional second arg COMINT is t the buffer will be in comint mode with 742If optional second arg COMINT is t the buffer will be in Comint mode with
738`compilation-shell-minor-mode'. 743`compilation-shell-minor-mode'.
739 744
740You can then use the command \\[next-error] to find the next error message 745You can then use the command \\[next-error] to find the next error message
@@ -767,8 +772,8 @@ to a function that generates a unique name."
767;; run compile with the default command line 772;; run compile with the default command line
768(defun recompile () 773(defun recompile ()
769 "Re-compile the program including the current buffer. 774 "Re-compile the program including the current buffer.
770If this is run in a compilation-mode buffer, re-use the arguments from the 775If this is run in a Compilation mode buffer, re-use the arguments from the
771original use. Otherwise, it recompiles using `compile-command'." 776original use. Otherwise, recompile using `compile-command'."
772 (interactive) 777 (interactive)
773 (save-some-buffers (not compilation-ask-about-save) nil) 778 (save-some-buffers (not compilation-ask-about-save) nil)
774 (let ((default-directory (or compilation-directory default-directory))) 779 (let ((default-directory (or compilation-directory default-directory)))
@@ -778,9 +783,9 @@ original use. Otherwise, it recompiles using `compile-command'."
778(defcustom compilation-scroll-output nil 783(defcustom compilation-scroll-output nil
779 "*Non-nil to scroll the *compilation* buffer window as output appears. 784 "*Non-nil to scroll the *compilation* buffer window as output appears.
780 785
781Setting it causes the compilation-mode commands to put point at the 786Setting it causes the Compilation mode commands to put point at the
782end of their output window so that the end of the output is always 787end of their output window so that the end of the output is always
783visible rather than the begining." 788visible rather than the beginning."
784 :type 'boolean 789 :type 'boolean
785 :version "20.3" 790 :version "20.3"
786 :group 'compilation) 791 :group 'compilation)
@@ -827,11 +832,11 @@ Otherwise, construct a buffer name from MODE-NAME."
827The rest of the arguments are optional; for them, nil means use the default. 832The rest of the arguments are optional; for them, nil means use the default.
828 833
829MODE is the major mode to set in the compilation buffer. Mode 834MODE is the major mode to set in the compilation buffer. Mode
830may also be `t' meaning `compilation-shell-minor-mode' under `comint-mode'. 835may also be t meaning use `compilation-shell-minor-mode' under `comint-mode'.
831NAME-FUNCTION is a function called to name the buffer. 836NAME-FUNCTION is a function called to name the buffer.
832 837
833If HIGHLIGHT-REGEXP is non-nil, `next-error' will temporarily highlight 838If HIGHLIGHT-REGEXP is non-nil, `next-error' will temporarily highlight
834matching section of the visited source line; the default is to use the 839the matching section of the visited source line; the default is to use the
835global value of `compilation-highlight-regexp'. 840global value of `compilation-highlight-regexp'.
836 841
837Returns the compilation buffer created." 842Returns the compilation buffer created."
@@ -843,8 +848,8 @@ Returns the compilation buffer created."
843 (process-environment 848 (process-environment
844 (append 849 (append
845 compilation-environment 850 compilation-environment
846 (if (and (boundp 'system-uses-terminfo) 851 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
847 system-uses-terminfo) 852 system-uses-terminfo)
848 (list "TERM=dumb" "TERMCAP=" 853 (list "TERM=dumb" "TERMCAP="
849 (format "COLUMNS=%d" (window-width))) 854 (format "COLUMNS=%d" (window-width)))
850 (list "TERM=emacs" 855 (list "TERM=emacs"
@@ -1141,7 +1146,9 @@ The global commands next/previous/first-error/goto-error use this.")
1141(defconst compilation-turn-on-font-lock 'turn-on-font-lock) 1146(defconst compilation-turn-on-font-lock 'turn-on-font-lock)
1142 1147
1143(defun compilation-setup (&optional minor) 1148(defun compilation-setup (&optional minor)
1144 "Prepare the buffer for the compilation parsing commands to work." 1149 "Prepare the buffer for the compilation parsing commands to work.
1150Optional argument MINOR indicates this is called from
1151`compilation-minor-mode'."
1145 (make-local-variable 'compilation-current-error) 1152 (make-local-variable 'compilation-current-error)
1146 (make-local-variable 'compilation-error-screen-columns) 1153 (make-local-variable 'compilation-error-screen-columns)
1147 (make-local-variable 'overlay-arrow-position) 1154 (make-local-variable 'overlay-arrow-position)
@@ -1150,7 +1157,7 @@ The global commands next/previous/first-error/goto-error use this.")
1150 '(directory message help-echo mouse-face debug)) 1157 '(directory message help-echo mouse-face debug))
1151 (set (make-local-variable 'compilation-locs) 1158 (set (make-local-variable 'compilation-locs)
1152 (make-hash-table :test 'equal :weakness 'value)) 1159 (make-hash-table :test 'equal :weakness 'value))
1153 ;; lazy-lock would never find the message unless it's scrolled to 1160 ;; lazy-lock would never find the message unless it's scrolled to.
1154 ;; jit-lock might fontify some things too late. 1161 ;; jit-lock might fontify some things too late.
1155 (set (make-local-variable 'font-lock-support-mode) nil) 1162 (set (make-local-variable 'font-lock-support-mode) nil)
1156 (set (make-local-variable 'font-lock-maximum-size) nil) 1163 (set (make-local-variable 'font-lock-maximum-size) nil)
@@ -1198,7 +1205,7 @@ Turning the mode on runs the normal hook `compilation-minor-mode-hook'."
1198 (font-lock-fontify-buffer))) 1205 (font-lock-fontify-buffer)))
1199 1206
1200(defun compilation-handle-exit (process-status exit-status msg) 1207(defun compilation-handle-exit (process-status exit-status msg)
1201 "Write msg in the current buffer and hack its mode-line-process." 1208 "Write MSG in the current buffer and hack its mode-line-process."
1202 (let ((buffer-read-only nil) 1209 (let ((buffer-read-only nil)
1203 (status (if compilation-exit-message-function 1210 (status (if compilation-exit-message-function
1204 (funcall compilation-exit-message-function 1211 (funcall compilation-exit-message-function
@@ -1343,7 +1350,7 @@ select the source buffer."
1343 (pop-to-buffer compilation-last-buffer)) 1350 (pop-to-buffer compilation-last-buffer))
1344 1351
1345(defun previous-error-no-select (n) 1352(defun previous-error-no-select (n)
1346 "Move point to the previous error in the compilation buffer and highlight match. 1353 "Move point to previous error in compilation buffer and highlight match.
1347Prefix arg N says how many error messages to move backwards (or 1354Prefix arg N says how many error messages to move backwards (or
1348forwards, if negative). 1355forwards, if negative).
1349Finds and highlights the source line like \\[previous-error], but does not 1356Finds and highlights the source line like \\[previous-error], but does not
@@ -1537,7 +1544,7 @@ region and the first line of the next region."
1537 :version "21.4") 1544 :version "21.4")
1538 1545
1539(defsubst compilation-set-window (w mk) 1546(defsubst compilation-set-window (w mk)
1540 ;; Align the compilation output window W with marker MK near top. 1547 "Align the compilation output window W with marker MK near top."
1541 (set-window-start w (save-excursion 1548 (set-window-start w (save-excursion
1542 (goto-char mk) 1549 (goto-char mk)
1543 (beginning-of-line (- 1 compilation-context-lines)) 1550 (beginning-of-line (- 1 compilation-context-lines))
@@ -1545,8 +1552,8 @@ region and the first line of the next region."
1545 (set-window-point w mk)) 1552 (set-window-point w mk))
1546 1553
1547(defun compilation-goto-locus (msg mk end-mk) 1554(defun compilation-goto-locus (msg mk end-mk)
1548 "Jump to an error MESSAGE and SOURCE. 1555 "Jump to an error corresponding to MSG at MK.
1549All arguments are markers. If SOURCE-END is non nil, mark is set there." 1556All arguments are markers. If END-MK is non nil, mark is set there."
1550 (if (eq (window-buffer (selected-window)) 1557 (if (eq (window-buffer (selected-window))
1551 (marker-buffer msg)) 1558 (marker-buffer msg))
1552 ;; If the compilation buffer window is selected, 1559 ;; If the compilation buffer window is selected,
@@ -1654,7 +1661,7 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
1654 buffer))) 1661 buffer)))
1655 1662
1656(defun compilation-normalize-filename (filename) 1663(defun compilation-normalize-filename (filename)
1657 "Convert a filename string found in an error message to make it usable." 1664 "Convert FILENAME string found in an error message to make it usable."
1658 1665
1659 ;; Check for a comint-file-name-prefix and prepend it if 1666 ;; Check for a comint-file-name-prefix and prepend it if
1660 ;; appropriate. (This is very useful for 1667 ;; appropriate. (This is very useful for
@@ -1722,7 +1729,7 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
1722(defun compile-buffer-substring (n) (if n (match-string n))) 1729(defun compile-buffer-substring (n) (if n (match-string n)))
1723 1730
1724(defun compilation-compat-error-properties (err) 1731(defun compilation-compat-error-properties (err)
1725 ;; Map old-style ERROR to new-style MESSAGE. 1732 "Map old-style error ERR to new-style message."
1726 (let* ((dst (cdr err)) 1733 (let* ((dst (cdr err))
1727 (loc (cond ((markerp dst) (list nil nil nil dst)) 1734 (loc (cond ((markerp dst) (list nil nil nil dst))
1728 ((consp dst) 1735 ((consp dst)
@@ -1732,6 +1739,7 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
1732 `(face nil 1739 `(face nil
1733 message ,(list loc 2) 1740 message ,(list loc 2)
1734 help-echo "mouse-2: visit the source location" 1741 help-echo "mouse-2: visit the source location"
1742 keymap compilation-button-map
1735 mouse-face highlight))) 1743 mouse-face highlight)))
1736 1744
1737(defun compilation-compat-parse-errors (limit) 1745(defun compilation-compat-parse-errors (limit)