aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-07-10 16:01:25 +0000
committerStefan Monnier2007-07-10 16:01:25 +0000
commit813fb3fe82c53a5586bcf4566da7bd3d15a87486 (patch)
tree954fb20e1f90f772eabe325e5ed841ca7f9772a8
parent8071c00f471b737c6f86255671705a2c40c189e4 (diff)
downloademacs-813fb3fe82c53a5586bcf4566da7bd3d15a87486.tar.gz
emacs-813fb3fe82c53a5586bcf4566da7bd3d15a87486.zip
(compilation-auto-jump-to-first-error,compilation-auto-jump-to-next): New vars.
(compilation-auto-jump): New function. (compilation-error-properties): Use them to jump to first error. (compilation-start): Set the var if requested.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/progmodes/compile.el51
3 files changed, 46 insertions, 14 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 4323f6ff1cf..6d30e2a7b91 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -73,6 +73,9 @@ recenter the visited source file. Its value can be a number (for example,
73 73
74* Changes in Specialized Modes and Packages in Emacs 23.1 74* Changes in Specialized Modes and Packages in Emacs 23.1
75 75
76** compilation-auto-jump-to-first-error tells `compile' to jump to
77the first error encountered during compilations.
78
76** In the `copyright' package, you can specify your copyright holders's names. 79** In the `copyright' package, you can specify your copyright holders's names.
77Only copyright lines with holders matching copyright-names-regexp will be 80Only copyright lines with holders matching copyright-names-regexp will be
78considered for update. 81considered for update.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a9438965ed..ae0f9fe2247 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12007-07-10 Stefan Monnier <monnier@iro.umontreal.ca> 12007-07-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * progmodes/compile.el (compilation-auto-jump-to-first-error)
4 (compilation-auto-jump-to-next): New vars.
5 (compilation-auto-jump): New function.
6 (compilation-error-properties): Use them to jump to first error.
7 (compilation-start): Set the var if requested.
8
3 * emacs-lisp/autoload.el (update-directory-autoloads): Remove 9 * emacs-lisp/autoload.el (update-directory-autoloads): Remove
4 duplicates without also removing entries from other directories. 10 duplicates without also removing entries from other directories.
5 11
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index ce73ef30ca0..0d08b755a9e 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -87,13 +87,13 @@
87 87
88;;;###autoload 88;;;###autoload
89(defcustom compilation-mode-hook nil 89(defcustom compilation-mode-hook nil
90 "*List of hook functions run by `compilation-mode' (see `run-mode-hooks')." 90 "List of hook functions run by `compilation-mode' (see `run-mode-hooks')."
91 :type 'hook 91 :type 'hook
92 :group 'compilation) 92 :group 'compilation)
93 93
94;;;###autoload 94;;;###autoload
95(defcustom compilation-window-height nil 95(defcustom compilation-window-height nil
96 "*Number of lines in a compilation window. If nil, use Emacs default." 96 "Number of lines in a compilation window. If nil, use Emacs default."
97 :type '(choice (const :tag "Default" nil) 97 :type '(choice (const :tag "Default" nil)
98 integer) 98 integer)
99 :group 'compilation) 99 :group 'compilation)
@@ -442,7 +442,7 @@ Highlight entire line if t; don't highlight source lines if nil.")
442 "Overlay used to temporarily highlight compilation matches.") 442 "Overlay used to temporarily highlight compilation matches.")
443 443
444(defcustom compilation-error-screen-columns t 444(defcustom compilation-error-screen-columns t
445 "*If non-nil, column numbers in error messages are screen columns. 445 "If non-nil, column numbers in error messages are screen columns.
446Otherwise they are interpreted as character positions, with 446Otherwise they are interpreted as character positions, with
447each character occupying one column. 447each character occupying one column.
448The default is to use screen columns, which requires that the compilation 448The default is to use screen columns, which requires that the compilation
@@ -453,21 +453,21 @@ especially the TAB character."
453 :version "20.4") 453 :version "20.4")
454 454
455(defcustom compilation-read-command t 455(defcustom compilation-read-command t
456 "*Non-nil means \\[compile] reads the compilation command to use. 456 "Non-nil means \\[compile] reads the compilation command to use.
457Otherwise, \\[compile] just uses the value of `compile-command'." 457Otherwise, \\[compile] just uses the value of `compile-command'."
458 :type 'boolean 458 :type 'boolean
459 :group 'compilation) 459 :group 'compilation)
460 460
461;;;###autoload 461;;;###autoload
462(defcustom compilation-ask-about-save t 462(defcustom compilation-ask-about-save t
463 "*Non-nil means \\[compile] asks which buffers to save before compiling. 463 "Non-nil means \\[compile] asks which buffers to save before compiling.
464Otherwise, it saves all modified buffers without asking." 464Otherwise, it saves all modified buffers without asking."
465 :type 'boolean 465 :type 'boolean
466 :group 'compilation) 466 :group 'compilation)
467 467
468;;;###autoload 468;;;###autoload
469(defcustom compilation-search-path '(nil) 469(defcustom compilation-search-path '(nil)
470 "*List of directories to search for source files named in error messages. 470 "List of directories to search for source files named in error messages.
471Elements should be directory names, not file names of directories. 471Elements should be directory names, not file names of directories.
472The value nil as an element means to try the default directory." 472The value nil as an element means to try the default directory."
473 :type '(repeat (choice (const :tag "Default" nil) 473 :type '(repeat (choice (const :tag "Default" nil)
@@ -476,7 +476,7 @@ The value nil as an element means to try the default directory."
476 476
477;;;###autoload 477;;;###autoload
478(defcustom compile-command "make -k " 478(defcustom compile-command "make -k "
479 "*Last shell command used to do a compilation; default for next compilation. 479 "Last shell command used to do a compilation; default for next compilation.
480 480
481Sometimes it is useful for files to supply local values for this variable. 481Sometimes it is useful for files to supply local values for this variable.
482You might also use mode hooks to specify it in certain modes, like this: 482You might also use mode hooks to specify it in certain modes, like this:
@@ -494,7 +494,7 @@ You might also use mode hooks to specify it in certain modes, like this:
494 494
495;;;###autoload 495;;;###autoload
496(defcustom compilation-disable-input nil 496(defcustom compilation-disable-input nil
497 "*If non-nil, send end-of-file as compilation process input. 497 "If non-nil, send end-of-file as compilation process input.
498This only affects platforms that support asynchronous processes (see 498This only affects platforms that support asynchronous processes (see
499`start-process'); synchronous compilation processes never accept input." 499`start-process'); synchronous compilation processes never accept input."
500 :type 'boolean 500 :type 'boolean
@@ -605,6 +605,14 @@ Faces `compilation-error-face', `compilation-warning-face',
605(defvar compilation-error-list nil) 605(defvar compilation-error-list nil)
606(defvar compilation-old-error-list nil) 606(defvar compilation-old-error-list nil)
607 607
608(defcustom compilation-auto-jump-to-first-error nil
609 "If non-nil, automatically jump to the first error after `compile'."
610 :type 'boolean)
611
612(defvar compilation-auto-jump-to-next nil
613 "If non-nil, automatically jump to the next error encountered.")
614(make-variable-buffer-local 'compilation-auto-jump-to-next)
615
608(defun compilation-face (type) 616(defun compilation-face (type)
609 (or (and (car type) (match-end (car type)) compilation-warning-face) 617 (or (and (car type) (match-end (car type)) compilation-warning-face)
610 (and (cdr type) (match-end (cdr type)) compilation-info-face) 618 (and (cdr type) (match-end (cdr type)) compilation-info-face)
@@ -652,13 +660,18 @@ Faces `compilation-error-face', `compilation-warning-face',
652 l2 660 l2
653 (setcdr l1 (cons (list ,key) l2))))))) 661 (setcdr l1 (cons (list ,key) l2)))))))
654 662
663(defun compilation-auto-jump (buffer pos)
664 (with-current-buffer buffer
665 (goto-char pos)
666 (compile-goto-error)))
655 667
656;; This function is the central driver, called when font-locking to gather 668;; This function is the central driver, called when font-locking to gather
657;; all information needed to later jump to corresponding source code. 669;; all information needed to later jump to corresponding source code.
658;; Return a property list with all meta information on this error location. 670;; Return a property list with all meta information on this error location.
659 671
660(defun compilation-error-properties (file line end-line col end-col type fmt) 672(defun compilation-error-properties (file line end-line col end-col type fmt)
661 (unless (< (next-single-property-change (match-beginning 0) 'directory nil (point)) 673 (unless (< (next-single-property-change (match-beginning 0)
674 'directory nil (point))
662 (point)) 675 (point))
663 (if file 676 (if file
664 (if (functionp file) 677 (if (functionp file)
@@ -710,6 +723,13 @@ Faces `compilation-error-face', `compilation-warning-face',
710 (setq type (or (and (car type) (match-end (car type)) 1) 723 (setq type (or (and (car type) (match-end (car type)) 1)
711 (and (cdr type) (match-end (cdr type)) 0) 724 (and (cdr type) (match-end (cdr type)) 0)
712 2))) 725 2)))
726
727 (when (and compilation-auto-jump-to-next
728 (>= type compilation-skip-threshold))
729 (kill-local-variable 'compilation-auto-jump-to-next)
730 (run-with-timer 0 nil 'compilation-auto-jump
731 (current-buffer) (match-beginning 0)))
732
713 (compilation-internal-error-properties file line end-line col end-col type fmt))) 733 (compilation-internal-error-properties file line end-line col end-col type fmt)))
714 734
715(defun compilation-move-to-column (col screen) 735(defun compilation-move-to-column (col screen)
@@ -932,7 +952,7 @@ original use. Otherwise, recompile using `compile-command'."
932 `(,(eval compile-command)))))) 952 `(,(eval compile-command))))))
933 953
934(defcustom compilation-scroll-output nil 954(defcustom compilation-scroll-output nil
935 "*Non-nil to scroll the *compilation* buffer window as output appears. 955 "Non-nil to scroll the *compilation* buffer window as output appears.
936 956
937Setting it causes the Compilation mode commands to put point at the 957Setting it causes the Compilation mode commands to put point at the
938end of their output window so that the end of the output is always 958end of their output window so that the end of the output is always
@@ -1026,8 +1046,9 @@ Returns the compilation buffer created."
1026 ;; Clear out the compilation buffer. 1046 ;; Clear out the compilation buffer.
1027 (let ((inhibit-read-only t) 1047 (let ((inhibit-read-only t)
1028 (default-directory thisdir)) 1048 (default-directory thisdir))
1029 ;; Then evaluate a cd command if any, but don't perform it yet, else start-command 1049 ;; Then evaluate a cd command if any, but don't perform it yet, else
1030 ;; would do it again through the shell: (cd "..") AND sh -c "cd ..; make" 1050 ;; start-command would do it again through the shell: (cd "..") AND
1051 ;; sh -c "cd ..; make"
1031 (cd (if (string-match "^\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]" command) 1052 (cd (if (string-match "^\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]" command)
1032 (if (match-end 1) 1053 (if (match-end 1)
1033 (substitute-env-vars (match-string 1 command)) 1054 (substitute-env-vars (match-string 1 command))
@@ -1043,6 +1064,8 @@ Returns the compilation buffer created."
1043 (if highlight-regexp 1064 (if highlight-regexp
1044 (set (make-local-variable 'compilation-highlight-regexp) 1065 (set (make-local-variable 'compilation-highlight-regexp)
1045 highlight-regexp)) 1066 highlight-regexp))
1067 (if compilation-auto-jump-to-first-error
1068 (set (make-local-variable 'compilation-auto-jump-to-next) t))
1046 ;; Output a mode setter, for saving and later reloading this buffer. 1069 ;; Output a mode setter, for saving and later reloading this buffer.
1047 (insert "-*- mode: " name-of-mode 1070 (insert "-*- mode: " name-of-mode
1048 "; default-directory: " (prin1-to-string default-directory) 1071 "; default-directory: " (prin1-to-string default-directory)
@@ -1244,7 +1267,7 @@ Returns the compilation buffer created."
1244 "*If non-nil, skip multiple error messages for the same source location.") 1267 "*If non-nil, skip multiple error messages for the same source location.")
1245 1268
1246(defcustom compilation-skip-threshold 1 1269(defcustom compilation-skip-threshold 1
1247 "*Compilation motion commands skip less important messages. 1270 "Compilation motion commands skip less important messages.
1248The value can be either 2 -- skip anything less than error, 1 -- 1271The value can be either 2 -- skip anything less than error, 1 --
1249skip anything less than warning or 0 -- don't skip any messages. 1272skip anything less than warning or 0 -- don't skip any messages.
1250Note that all messages not positively identified as warning or 1273Note that all messages not positively identified as warning or
@@ -1256,7 +1279,7 @@ info, are considered errors."
1256 :version "22.1") 1279 :version "22.1")
1257 1280
1258(defcustom compilation-skip-visited nil 1281(defcustom compilation-skip-visited nil
1259 "*Compilation motion commands skip visited messages if this is t. 1282 "Compilation motion commands skip visited messages if this is t.
1260Visited messages are ones for which the file, line and column have been jumped 1283Visited messages are ones for which the file, line and column have been jumped
1261to from the current content in the current compilation buffer, even if it was 1284to from the current content in the current compilation buffer, even if it was
1262from a different message." 1285from a different message."