changeset 54941:2f96b3c58e6d

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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 16 Apr 2004 23:22:07 +0000
parents fe6ea1c4a27d
children ea5155e2fbe2
files lisp/progmodes/compile.el
diffstat 1 files changed, 41 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Fri Apr 16 23:06:34 2004 +0000
+++ b/lisp/progmodes/compile.el	Fri Apr 16 23:22:07 2004 +0000
@@ -100,7 +100,7 @@
 ;;;###autoload
 (defvar compilation-process-setup-function nil
   "*Function to call to customize the compilation process.
-This functions is called immediately before the compilation process is
+This function is called immediately before the compilation process is
 started.  It can be used to set any variables or functions that are used
 while processing the output of the compilation process.  The function
 is called with variables `compilation-buffer' and `compilation-window'
@@ -187,8 +187,9 @@
      "^\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) :\
  \\(?:warnin\\(g\\)\\|informationa\\(l\\)\\)?" 1 2 3 (4 . 5))
 
+    ;; fixme: should be `mips'
     (irix
-     "^[a-z0-9/]+: \\(?:[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\
+     "^[-[:alnum:]_/]+: \\(?:[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\
  \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2))
 
     (java
@@ -206,7 +207,7 @@
 \\(.+\\):\\([0-9]+\\)\\(?:\\(:\\)\\|\\(,\\)\\)?" 1 2 nil (3 . 4))
 
     (gnu
-     "^\\(?:[a-zA-Z][-a-zA-Z0-9.]+: ?\\)?\
+     "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\)?\
 \\([/.]*[a-zA-Z]:?[^ \t\n:]*\\): ?\
 \\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\
 \\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\
@@ -228,6 +229,7 @@
       (1 (compilation-error-properties 2 3 nil nil nil 0 nil)
 	 append)))
 
+    ;; Should be lint-1, lint-2 (SysV lint)
     (mips-1
      " (\\([0-9]+\\)) in \\([^ \n]+\\)" 2 1)
     (mips-2
@@ -261,15 +263,16 @@
      nil 1 nil (3) nil (2 (compilation-face '(3))))
 
     (sun
-     ": \\(?:ERROR\\|WARNIN\\(G\\)\\|REMAR\\(K\\)\\) \\(?:[a-zA-Z0-9 ]+, \\)?\
+     ": \\(?:ERROR\\|WARNIN\\(G\\)\\|REMAR\\(K\\)\\) \\(?:[[:alnum:] ]+, \\)?\
 File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
      3 4 5 (1 . 2))
 
     (sun-ada
      "^\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2 3)
 
-    (ultrix
-     "^\\(?:cfe\\|fort\\): \\(Warning\\)?[^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3 nil (1))
+    ;; Redundant with `mips'
+;;    (ultrix
+;;      "^\\(?:cfe\\|fort\\): \\(Warning\\)?[^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3 nil (1))
 
     (4bsd
      "\\(?:^\\|::  \\|\\S ( \\)\\(/[^ \n\t()]+\\)(\\([0-9]+\\))\
@@ -279,14 +282,14 @@
 (defcustom compilation-error-regexp-alist
   (mapcar 'car compilation-error-regexp-alist-alist)
   "Alist that specifies how to match errors in compiler output.
-Note that on Unix exerything is a valid filename, so these
+Note that on Unix everything is a valid filename, so these
 matchers must make some common sense assumptions, which catch
 normal cases.  A shorter list will be lighter on resource usage.
 
 Instead of an alist element, you can use a symbol, which is
 looked up in `compilation-error-regexp-alist-alist'.  You can see
 the predefined symbols and their effects in the file
-`etc/compilation.txt' (linked below if your are customizing this).
+`etc/compilation.txt' (linked below if you are customizing this).
 
 Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK
 HIGHLIGHT...]).  If REGEXP matches, the FILE'th subexpression
@@ -357,7 +360,7 @@
       (1 font-lock-variable-name-face)
       (2 (compilation-face '(4 . 3))))
      ;; Command output lines.  Recognize `make[n]:' lines too.
-     ("^\\([A-Za-z_0-9/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
+     ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
       (1 font-lock-function-name-face) (3 compilation-line-face nil t))
      (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1)
      ("^Compilation finished" . compilation-info-face)
@@ -427,7 +430,7 @@
 (defvar compilation-locs ())
 
 (defvar compilation-debug nil
-  "*Set this to `t' before creating a *compilation* buffer.
+  "*Set this to t before creating a *compilation* buffer.
 Then every error line will have a debug text property with the matcher that
 fit this line and the match data.  Use `describe-text-properties'.")
 
@@ -494,7 +497,7 @@
 
 
 ;; Used for compatibility with the old compile.el.
-(defvar compilation-parsing-end nil)
+(defvar compilation-parsing-end (make-marker))
 (defvar compilation-parse-errors-function nil)
 (defvar compilation-error-list nil)
 (defvar compilation-old-error-list nil)
@@ -518,6 +521,7 @@
 			 '(nil))	; nil only isn't a property-change
 		   (cons (match-string-no-properties idx) dir))
       mouse-face highlight
+      keymap compilation-button-map
       help-echo "mouse-2: visit current directory")))
 
 ;; Data type `reverse-ordered-alist' retriever.	 This function retrieves the
@@ -528,6 +532,7 @@
 ;; may be nil.	The other KEYs are ordered backwards so that growing line
 ;; numbers can be inserted in front and searching can abort after half the
 ;; list on average.
+(eval-when-compile		    ;Don't keep it at runtime if not needed.
 (defmacro compilation-assq (key alist)
   `(let* ((l1 ,alist)
 	  (l2 (cdr l1)))
@@ -538,7 +543,7 @@
 			l2 (cdr l1)))
 		(if l2 (eq ,key (caar l2))))
 	      l2
-	    (setcdr l1 (cons (list ,key) l2))))))
+	    (setcdr l1 (cons (list ,key) l2)))))))
 
 
 ;; This function is the central driver, called when font-locking to gather
@@ -691,9 +696,9 @@
 	      ;; error location.  Let's do our best.
 	      `(,(car item)
 		(0 (compilation-compat-error-properties
-		    (funcall ',line (list* (match-string ,file)
-					   default-directory
-					   ',(nthcdr 4 item))
+		    (funcall ',line (cons (match-string ,file)
+					  (cons default-directory
+						',(nthcdr 4 item)))
 			     ,(if col `(match-string ,col)))))
 		(,file compilation-error-face t))
 
@@ -734,7 +739,7 @@
 Runs COMMAND, a shell command, in a separate process asynchronously
 with output going to the buffer `*compilation*'.
 
-If optional second arg COMINT is t the buffer will be in comint mode with
+If optional second arg COMINT is t the buffer will be in Comint mode with
 `compilation-shell-minor-mode'.
 
 You can then use the command \\[next-error] to find the next error message
@@ -767,8 +772,8 @@
 ;; run compile with the default command line
 (defun recompile ()
   "Re-compile the program including the current buffer.
-If this is run in a compilation-mode buffer, re-use the arguments from the
-original use.  Otherwise, it recompiles using `compile-command'."
+If this is run in a Compilation mode buffer, re-use the arguments from the
+original use.  Otherwise, recompile using `compile-command'."
   (interactive)
   (save-some-buffers (not compilation-ask-about-save) nil)
   (let ((default-directory (or compilation-directory default-directory)))
@@ -778,9 +783,9 @@
 (defcustom compilation-scroll-output nil
   "*Non-nil to scroll the *compilation* buffer window as output appears.
 
-Setting it causes the compilation-mode commands to put point at the
+Setting it causes the Compilation mode commands to put point at the
 end of their output window so that the end of the output is always
-visible rather than the begining."
+visible rather than the beginning."
   :type 'boolean
   :version "20.3"
   :group 'compilation)
@@ -827,11 +832,11 @@
 The rest of the arguments are optional; for them, nil means use the default.
 
 MODE is the major mode to set in the compilation buffer.  Mode
-may also be `t' meaning `compilation-shell-minor-mode' under `comint-mode'.
+may also be t meaning use `compilation-shell-minor-mode' under `comint-mode'.
 NAME-FUNCTION is a function called to name the buffer.
 
 If HIGHLIGHT-REGEXP is non-nil, `next-error' will temporarily highlight
-matching section of the visited source line; the default is to use the
+the matching section of the visited source line; the default is to use the
 global value of `compilation-highlight-regexp'.
 
 Returns the compilation buffer created."
@@ -843,8 +848,8 @@
 	(process-environment
 	 (append
 	  compilation-environment
-	  (if (and (boundp 'system-uses-terminfo)
-		   system-uses-terminfo)
+	  (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
+		  system-uses-terminfo)
 	      (list "TERM=dumb" "TERMCAP="
 		    (format "COLUMNS=%d" (window-width)))
 	    (list "TERM=emacs"
@@ -1141,7 +1146,9 @@
 (defconst compilation-turn-on-font-lock 'turn-on-font-lock)
 
 (defun compilation-setup (&optional minor)
-  "Prepare the buffer for the compilation parsing commands to work."
+  "Prepare the buffer for the compilation parsing commands to work.
+Optional argument MINOR indicates this is called from
+`compilation-minor-mode'."
   (make-local-variable 'compilation-current-error)
   (make-local-variable 'compilation-error-screen-columns)
   (make-local-variable 'overlay-arrow-position)
@@ -1150,7 +1157,7 @@
        '(directory message help-echo mouse-face debug))
   (set (make-local-variable 'compilation-locs)
        (make-hash-table :test 'equal :weakness 'value))
-  ;; lazy-lock would never find the message unless it's scrolled to
+  ;; lazy-lock would never find the message unless it's scrolled to.
   ;; jit-lock might fontify some things too late.
   (set (make-local-variable 'font-lock-support-mode) nil)
   (set (make-local-variable 'font-lock-maximum-size) nil)
@@ -1198,7 +1205,7 @@
     (font-lock-fontify-buffer)))
 
 (defun compilation-handle-exit (process-status exit-status msg)
-  "Write msg in the current buffer and hack its mode-line-process."
+  "Write MSG in the current buffer and hack its mode-line-process."
   (let ((buffer-read-only nil)
 	(status (if compilation-exit-message-function
 		    (funcall compilation-exit-message-function
@@ -1343,7 +1350,7 @@
   (pop-to-buffer compilation-last-buffer))
 
 (defun previous-error-no-select (n)
-  "Move point to the previous error in the compilation buffer and highlight match.
+  "Move point to previous error in compilation buffer and highlight match.
 Prefix arg N says how many error messages to move backwards (or
 forwards, if negative).
 Finds and highlights the source line like \\[previous-error], but does not
@@ -1537,7 +1544,7 @@
   :version "21.4")
 
 (defsubst compilation-set-window (w mk)
-  ;; Align the compilation output window W with marker MK near top.
+  "Align the compilation output window W with marker MK near top."
   (set-window-start w (save-excursion
 			(goto-char mk)
 			(beginning-of-line (- 1 compilation-context-lines))
@@ -1545,8 +1552,8 @@
   (set-window-point w mk))
 
 (defun compilation-goto-locus (msg mk end-mk)
-  "Jump to an error MESSAGE and SOURCE.
-All arguments are markers.  If SOURCE-END is non nil, mark is set there."
+  "Jump to an error corresponding to MSG at MK.
+All arguments are markers.  If END-MK is non nil, mark is set there."
   (if (eq (window-buffer (selected-window))
 	  (marker-buffer msg))
       ;; If the compilation buffer window is selected,
@@ -1654,7 +1661,7 @@
       buffer)))
 
 (defun compilation-normalize-filename (filename)
-  "Convert a filename string found in an error message to make it usable."
+  "Convert FILENAME string found in an error message to make it usable."
 
   ;; Check for a comint-file-name-prefix and prepend it if
   ;; appropriate.  (This is very useful for
@@ -1722,7 +1729,7 @@
 (defun compile-buffer-substring (n) (if n (match-string n)))
 
 (defun compilation-compat-error-properties (err)
-  ;; Map old-style ERROR to new-style MESSAGE.
+  "Map old-style error ERR to new-style message."
   (let* ((dst (cdr err))
 	 (loc (cond ((markerp dst) (list nil nil nil dst))
 		    ((consp dst)
@@ -1732,6 +1739,7 @@
     `(face nil
       message ,(list loc 2)
       help-echo "mouse-2: visit the source location"
+      keymap compilation-button-map
       mouse-face highlight)))
 
 (defun compilation-compat-parse-errors (limit)