comparison lisp/progmodes/compile.el @ 8351:bbd2d410ab94

Finish installing previous change.
author Richard M. Stallman <rms@gnu.org>
date Tue, 26 Jul 1994 21:23:38 +0000
parents 95c011057e51
children a9f95d2ac181
comparison
equal deleted inserted replaced
8350:b3afbc67aa6b 8351:bbd2d410ab94
838 The current buffer should be the desired compilation output buffer." 838 The current buffer should be the desired compilation output buffer."
839 (or move (setq move 1)) 839 (or move (setq move 1))
840 (compile-reinitialize-errors reparse nil (and (not reparse) 840 (compile-reinitialize-errors reparse nil (and (not reparse)
841 (if (< move 1) 0 (1- move)))) 841 (if (< move 1) 0 (1- move))))
842 (let (next-errors next-error) 842 (let (next-errors next-error)
843 (save-excursion 843 (catch 'no-next-error
844 (set-buffer compilation-last-buffer) 844 (save-excursion
845 ;; compilation-error-list points to the "current" error. 845 (set-buffer compilation-last-buffer)
846 (setq next-errors 846 ;; compilation-error-list points to the "current" error.
847 (if (> move 0) 847 (setq next-errors
848 (nthcdr (1- move) 848 (if (> move 0)
849 compilation-error-list) 849 (nthcdr (1- move)
850 ;; Zero or negative arg; we need to move back in the list. 850 compilation-error-list)
851 (let ((n (1- move)) 851 ;; Zero or negative arg; we need to move back in the list.
852 (i 0) 852 (let ((n (1- move))
853 (e compilation-old-error-list)) 853 (i 0)
854 ;; See how many cdrs away the current error is from the start. 854 (e compilation-old-error-list))
855 (while (not (eq e compilation-error-list)) 855 ;; See how many cdrs away the current error is from the start.
856 (setq i (1+ i) 856 (while (not (eq e compilation-error-list))
857 e (cdr e))) 857 (setq i (1+ i)
858 (if (> (- n) i) 858 e (cdr e)))
859 (error "Moved back past first error") 859 (if (> (- n) i)
860 (nthcdr (+ i n) compilation-old-error-list)))) 860 (error "Moved back past first error")
861 next-error (car next-errors)) 861 (nthcdr (+ i n) compilation-old-error-list))))
862 (while 862 next-error (car next-errors))
863 (if (null next-error) 863 (while
864 (progn 864 (if (null next-error)
865 (and move (/= move 1) 865 (progn
866 (error (if (> move 0) 866 (and move (/= move 1)
867 "Moved past last error") 867 (error (if (> move 0)
868 "Moved back past first error")) 868 "Moved past last error")
869 ;; Forget existing error messages if compilation has finished. 869 "Moved back past first error"))
870 (if (not (and (get-buffer-process (current-buffer)) 870 ;; Forget existing error messages if compilation has finished.
871 (eq (process-status 871 (if (not (and (get-buffer-process (current-buffer))
872 (get-buffer-process 872 (eq (process-status
873 (current-buffer))) 873 (get-buffer-process
874 'run))) 874 (current-buffer)))
875 (compilation-forget-errors)) 875 'run)))
876 (error (concat compilation-error-message 876 (compilation-forget-errors))
877 (and (get-buffer-process (current-buffer)) 877 (if silent
878 (eq (process-status 878 (throw 'no-next-error nil)
879 (get-buffer-process 879 (error (concat compilation-error-message
880 (current-buffer))) 880 (and (get-buffer-process (current-buffer))
881 'run) 881 (eq (process-status
882 (get-buffer-process
883 (current-buffer)))
884 'run)
882 " yet"))))) 885 " yet")))))
883 (setq compilation-error-list (cdr next-errors)) 886 (setq compilation-error-list (cdr next-errors))
884 (if (null (cdr next-error)) 887 (if (null (cdr next-error))
885 ;; This error is boring. Go to the next. 888 ;; This error is boring. Go to the next.
886 t 889 t
887 (or (markerp (cdr next-error)) 890 (or (markerp (cdr next-error))
888 ;; This error has a filename/lineno pair. 891 ;; This error has a filename/lineno pair.
889 ;; Find the file and turn it into a marker. 892 ;; Find the file and turn it into a marker.
890 (let* ((fileinfo (car (cdr next-error))) 893 (let* ((fileinfo (car (cdr next-error)))
891 (buffer (compilation-find-file (cdr fileinfo) 894 (buffer (compilation-find-file (cdr fileinfo)
892 (car fileinfo) 895 (car fileinfo)
893 (car next-error)))) 896 (car next-error))))
894 (if (null buffer) 897 (if (null buffer)
895 ;; We can't find this error's file. 898 ;; We can't find this error's file.
896 ;; Remove all errors in the same file. 899 ;; Remove all errors in the same file.
897 (progn 900 (progn
898 (setq next-errors compilation-old-error-list) 901 (setq next-errors compilation-old-error-list)
899 (while next-errors 902 (while next-errors
900 (and (consp (cdr (car next-errors))) 903 (and (consp (cdr (car next-errors)))
901 (equal (car (cdr (car next-errors))) 904 (equal (car (cdr (car next-errors)))
902 fileinfo) 905 fileinfo)
903 (progn 906 (progn
904 (set-marker (car (car next-errors)) nil) 907 (set-marker (car (car next-errors)) nil)
905 (setcdr (car next-errors) nil))) 908 (setcdr (car next-errors) nil)))
906 (setq next-errors (cdr next-errors))) 909 (setq next-errors (cdr next-errors)))
907 ;; Look for the next error. 910 ;; Look for the next error.
908 t) 911 t)
909 ;; We found the file. Get a marker for this error. 912 ;; We found the file. Get a marker for this error.
910 ;; compilation-old-error-list is a buffer-local 913 ;; compilation-old-error-list is a buffer-local
911 ;; variable, so we must be careful to extract its value 914 ;; variable, so we must be careful to extract its value
912 ;; before switching to the source file buffer. 915 ;; before switching to the source file buffer.
913 (let ((errors compilation-old-error-list) 916 (let ((errors compilation-old-error-list)
914 (last-line (nth 1 (cdr next-error))) 917 (last-line (nth 1 (cdr next-error)))
915 (column (nth 2 (cdr next-error)))) 918 (column (nth 2 (cdr next-error))))
916 (set-buffer buffer) 919 (set-buffer buffer)
917 (save-excursion 920 (save-excursion
918 (save-restriction 921 (save-restriction
919 (widen) 922 (widen)
920 (goto-line last-line) 923 (goto-line last-line)
921 (if column 924 (if column
922 (move-to-column column) 925 (move-to-column column)
923 (beginning-of-line)) 926 (beginning-of-line))
924 (setcdr next-error (point-marker)) 927 (setcdr next-error (point-marker))
925 ;; Make all the other error messages referring 928 ;; Make all the other error messages referring
926 ;; to the same file have markers into the buffer. 929 ;; to the same file have markers into the buffer.
927 (while errors 930 (while errors
928 (and (consp (cdr (car errors))) 931 (and (consp (cdr (car errors)))
929 (equal (car (cdr (car errors))) fileinfo) 932 (equal (car (cdr (car errors))) fileinfo)
930 (let* ((this (nth 1 (cdr (car errors)))) 933 (let* ((this (nth 1 (cdr (car errors))))
931 (column (nth 2 (cdr (car errors)))) 934 (column (nth 2 (cdr (car errors))))
932 (lines (- this last-line))) 935 (lines (- this last-line)))
933 (if (eq selective-display t) 936 (if (eq selective-display t)
934 ;; When selective-display is t, 937 ;; When selective-display is t,
935 ;; each C-m is a line boundary, 938 ;; each C-m is a line boundary,
936 ;; as well as each newline. 939 ;; as well as each newline.
937 (if (< lines 0) 940 (if (< lines 0)
938 (re-search-backward "[\n\C-m]" 941 (re-search-backward "[\n\C-m]"
939 nil 'end 942 nil 'end
940 (- lines)) 943 (- lines))
941 (re-search-forward "[\n\C-m]" 944 (re-search-forward "[\n\C-m]"
942 nil 'end 945 nil 'end
943 lines)) 946 lines))
944 (forward-line lines)) 947 (forward-line lines))
945 (if column 948 (if column
946 (move-to-column column)) 949 (move-to-column column))
947 (setq last-line this) 950 (setq last-line this)
948 (setcdr (car errors) (point-marker)))) 951 (setcdr (car errors) (point-marker))))
949 (setq errors (cdr errors))))))))) 952 (setq errors (cdr errors)))))))))
950 ;; If we didn't get a marker for this error, or this 953 ;; If we didn't get a marker for this error, or this
951 ;; marker's buffer was killed, go on to the next one. 954 ;; marker's buffer was killed, go on to the next one.
952 (or (not (markerp (cdr next-error))) 955 (or (not (markerp (cdr next-error)))
953 (not (marker-buffer (cdr next-error)))))) 956 (not (marker-buffer (cdr next-error))))))
954 (setq next-errors compilation-error-list 957 (setq next-errors compilation-error-list
955 next-error (car next-errors))))) 958 next-error (car next-errors)))))
956 959
957 ;; Skip over multiple error messages for the same source location, 960 ;; Skip over multiple error messages for the same source location,
958 ;; so the next C-x ` won't go to an error in the same place. 961 ;; so the next C-x ` won't go to an error in the same place.
959 (while (and compilation-error-list 962 (while (and compilation-error-list