emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/compile.el


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/compile.el
Date: Fri, 12 Jul 2002 13:39:45 -0400

Index: emacs/lisp/progmodes/compile.el
diff -c emacs/lisp/progmodes/compile.el:1.257 
emacs/lisp/progmodes/compile.el:1.258
*** emacs/lisp/progmodes/compile.el:1.257       Fri Jun 14 09:58:28 2002
--- emacs/lisp/progmodes/compile.el     Fri Jul 12 13:39:45 2002
***************
*** 370,375 ****
--- 370,381 ----
  \\([a-zA-Z]?:?[^:( \t\n]+\\)\
   \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5)
  
+     ;; Valgrind (memory debugger for x86 GNU/Linux):
+     ;;  ==1332==    at 0x8008621: main (vtest.c:180)
+     ;; Currently this regexp only matches the first error.
+     ;; Thanks to Hans Petter Jansson <address@hidden> for his regexp wisdom.
+     ("^==[0-9]+==[^(]+\(([^:]+):([0-9]+)" 1 2)
+ 
      ;; 4.3BSD lint pass 2
      ;;        strcmp: variable # of args. llib-lc(359)  ::  
/usr/src/foo/foo.c(8)
      (".*[ \t:]\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(](+[ \t]*\\([0-9]+\\))[:) \t]*$"
***************
*** 2001,2006 ****
--- 2007,2040 ----
              (overlays-in (point-min) (point-max)))
        buffer)))
  
+ (defun compilation-normalize-filename (filename)
+   "Convert a 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
+   ;; compilation-minor-mode in an rlogin-mode buffer.)
+   (and (boundp 'comint-file-name-prefix)
+        ;; If file name is relative, default-directory will
+        ;; already contain the comint-file-name-prefix (done
+        ;; by compile-abbreviate-directory).
+        (file-name-absolute-p filename)
+        (setq filename
+            (concat comint-file-name-prefix filename)))
+ 
+   ;; If compilation-parse-errors-filename-function is
+   ;; defined, use it to process the filename.
+   (when compilation-parse-errors-filename-function
+     (setq filename
+         (funcall compilation-parse-errors-filename-function
+                  filename)))
+ 
+   ;; Some compilers (e.g. Sun's java compiler, reportedly)
+   ;; produce bogus file names like "./bar//foo.c" for file
+   ;; "bar/foo.c"; expand-file-name will collapse these into
+   ;; "/foo.c" and fail to find the appropriate file.  So we
+   ;; look for doubled slashes in the file name and fix them
+   ;; up in the buffer.
+   (setq filename (command-line-normalize-file-name filename)))
  
  ;; Set compilation-error-list to nil, and unchain the markers that point to 
the
  ;; error messages and their text, so that they no longer slow down gap motion.
***************
*** 2145,2175 ****
                        (error "\
  An error message with no file name and no file name has been seen earlier"))
  
!                   ;; Check for a comint-file-name-prefix and prepend it if
!                   ;; appropriate.  (This is very useful for
!                   ;; compilation-minor-mode in an rlogin-mode buffer.)
!                   (and (boundp 'comint-file-name-prefix)
!                        ;; If file name is relative, default-directory will
!                        ;; already contain the comint-file-name-prefix (done
!                        ;; by compile-abbreviate-directory).
!                        (file-name-absolute-p filename)
!                        (setq filename
!                              (concat comint-file-name-prefix filename)))
! 
!                   ;; If compilation-parse-errors-filename-function is
!                   ;; defined, use it to process the filename.
!                   (when compilation-parse-errors-filename-function
!                     (setq filename
!                           (funcall compilation-parse-errors-filename-function
!                                    filename)))
! 
!                   ;; Some compilers (e.g. Sun's java compiler, reportedly)
!                   ;; produce bogus file names like "./bar//foo.c" for file
!                   ;; "bar/foo.c"; expand-file-name will collapse these into
!                   ;; "/foo.c" and fail to find the appropriate file.  So we
!                   ;; look for doubled slashes in the file name and fix them
!                   ;; up in the buffer.
!                   (setq filename (command-line-normalize-file-name filename))
  
                    (setq filename
                          (cons filename (cons default-directory (cdr alist))))
--- 2179,2186 ----
                        (error "\
  An error message with no file name and no file name has been seen earlier"))
  
!                   ;; Clean up the file name string in several ways.
!                   (setq filename (compilation-normalize-filename filename))
  
                    (setq filename
                          (cons filename (cons default-directory (cdr alist))))
***************
*** 2240,2266 ****
  
                ;; Not an error message.
                (if (eq type `file)     ; Change current file.
!                   (and filename (setq compilation-current-file filename))
                  ;; Enter or leave directory.
                  (setq stack compilation-directory-stack)
!                 (and filename
!                      (file-directory-p
!                       (setq filename
!                             ;; The directory name in the message
!                             ;; is a truename.  Try to convert it to a form
!                             ;; like what the user typed in.
!                             (compile-abbreviate-directory
!                              (file-name-as-directory
!                               (expand-file-name filename))
!                              orig orig-expanded parent-expanded)))
!                      (if (eq type 'leave)
!                          (while (and stack
!                                      (not (string-equal (car stack)
!                                                         filename)))
!                            (setq stack (cdr stack)))
!                        (setq compilation-directory-stack
!                              (cons filename compilation-directory-stack)
!                              default-directory filename)))
                  (and (eq type 'leave)
                       stack
                       (setq compilation-directory-stack (cdr stack))
--- 2251,2287 ----
  
                ;; Not an error message.
                (if (eq type `file)     ; Change current file.
!                   (when filename
!                     (setq compilation-current-file
!                           ;; Clean up the file name string in several ways.
!                           (compilation-normalize-filename filename)))
                  ;; Enter or leave directory.
                  (setq stack compilation-directory-stack)
!                 ;; Don't check if it is really a directory.
!                 ;; Let the code to search and clean up file names
!                 ;; try to use it in any case.
!                 (when filename
!                   ;; Clean up the directory name string in several ways.
!                   (setq filename (compilation-normalize-filename filename))
!                   (setq filename
!                         ;; The directory name in the message
!                         ;; is a truename.  Try to convert it to a form
!                         ;; like what the user typed in.
!                         (compile-abbreviate-directory
!                          (file-name-as-directory
!                           (expand-file-name filename))
!                          orig orig-expanded parent-expanded))
!                   (if (eq type 'leave)
!                       ;; If we are leaving a specific directory,
!                       ;; as preparation, pop out of all other directories
!                       ;; that we entered nested within it.
!                       (while (and stack
!                                   (not (string-equal (car stack)
!                                                      filename)))
!                         (setq stack (cdr stack)))
!                     (setq compilation-directory-stack
!                           (cons filename compilation-directory-stack)
!                           default-directory filename)))
                  (and (eq type 'leave)
                       stack
                       (setq compilation-directory-stack (cdr stack))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]