bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#8014: 24.0.50; compilation-mode does not track directories


From: Stefan Monnier
Subject: bug#8014: 24.0.50; compilation-mode does not track directories
Date: Fri, 11 Mar 2011 23:30:07 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> Alas, clicking on the warnings does not work: I am asked which file I
>> want to visit. 

> This works in Emacs 23.
> It works in trunk if one redefines compilation--previous-directory as:

> (defun compilation--previous-directory (pos)
>   (previous-single-property-change pos 'compilation-directory))

> so I guess something is going wrong in that function, which is supposed
> to be a faster version of the above.

I've installed the patch below which seems to fix the problem on the
test case.


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2011-03-12 02:59:24 +0000
+++ lisp/ChangeLog      2011-03-12 04:27:18 +0000
@@ -1,5 +1,10 @@
 2011-03-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * progmodes/compile.el (compilation--previous-directory): Fix up
+       various nil/dead-marker mismatches.
+       (compilation-directory-properties, compilation-error-properties):
+       Don't call it at a position past the one we're about to change.
+
        * emacs-lisp/bytecomp.el (byte-compile-make-obsolete-variable):
        Disable obsolescence warnings in the file that declares it.
 

=== modified file 'lisp/progmodes/compile.el'
--- lisp/progmodes/compile.el   2011-02-19 21:23:51 +0000
+++ lisp/progmodes/compile.el   2011-03-12 04:26:31 +0000
@@ -860,13 +860,14 @@
                        (car compilation--previous-directory-cache)))
            (prev
             (previous-single-property-change
-             pos 'compilation-directory nil cache)))
+             pos 'compilation-directory nil cache))
+           (res
       (cond
        ((null cache)
         (setq compilation--previous-directory-cache
-              (cons (copy-marker pos) (copy-marker prev)))
+                    (cons (copy-marker pos) (if prev (copy-marker prev))))
         prev)
-       ((eq prev cache)
+             ((and prev (= prev cache))
         (if cache
             (set-marker (car compilation--previous-directory-cache) pos)
           (setq compilation--previous-directory-cache
@@ -875,12 +876,13 @@
        (t
         (if cache
             (progn
-              (set-marker (car compilation--previous-directory-cache) pos)
+                    (set-marker cache pos)
               (setcdr compilation--previous-directory-cache
                       (copy-marker prev)))
           (setq compilation--previous-directory-cache
-                (cons (copy-marker pos) (copy-marker prev))))
-        prev)))))
+                      (cons (copy-marker pos) (if prev (copy-marker prev)))))
+              prev))))
+      (if (markerp res) (marker-position res) res))))
 
 ;; Internal function for calculating the text properties of a directory
 ;; change message.  The compilation-directory property is important, because it
@@ -889,7 +891,7 @@
 (defun compilation-directory-properties (idx leave)
   (if leave (setq leave (match-end leave)))
   ;; find previous stack, and push onto it, or if `leave' pop it
-  (let ((dir (compilation--previous-directory (point))))
+  (let ((dir (compilation--previous-directory (match-beginning 0))))
     (setq dir (if dir (or (get-text-property (1- dir) 'compilation-directory)
                          (get-text-property dir 'compilation-directory))))
     `(font-lock-face ,(if leave
@@ -948,7 +950,8 @@
                             (match-string-no-properties file))))
          (let ((dir
            (unless (file-name-absolute-p file)
-                   (let ((pos (compilation--previous-directory (point))))
+                   (let ((pos (compilation--previous-directory
+                               (match-beginning 0))))
                      (when pos
                        (or (get-text-property (1- pos) 'compilation-directory)
                            (get-text-property pos 'compilation-directory)))))))






reply via email to

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