all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8014: 24.0.50; compilation-mode does not track directories
@ 2011-02-10 17:11 Sam Steingold
  2011-02-17  2:53 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2011-02-10 17:11 UTC (permalink / raw)
  To: 8014

In GNU Emacs 24.0.50.2 (x86_64-unknown-linux-gnu, X toolkit)
 of 2011-02-09 on tbox
Windowing system distributor `Colin Harrison', version 11.0.60900031
configured using `configure  '--with-x-toolkit=lucid''

I have a buffer with this text:
======================================================
make: Entering directory `/home/sds/code/core'
make[1]: Entering directory `/home/sds/code/core/tests'
make[1]: Leaving directory `/home/sds/code/core/tests'
make: Leaving directory `/home/sds/code/core'
make: Entering directory `/home/sds/code/m2'
make[1]: Entering directory `/home/sds/code/core'
make[1]: Leaving directory `/home/sds/code/core'
make[1]: Entering directory `/home/sds/code/m2/defs'
make[1]: Leaving directory `/home/sds/code/m2/defs'
meng/book.h:170: warning: unused parameter 'do_print'
meng/book.h:170: warning: unused parameter 'do_print'
../../m2/commit/shmem_buffer.h:41: warning: comparison between signed and unsigned integer expressions
../../m2/commit/shmem_buffer.h:62: warning: comparison between signed and unsigned integer expressions
srserver.cpp:369: warning: unused variable 'conn'
srserver.cpp:366: warning: unused parameter 'listen_at'
srserver.cpp:382: warning: unused parameter 'success'
../../m2/commit/merger.h:83: warning: control reaches end of non-void function
======================================================

I do M-x compilation-mode RET and see very pretty fontifications which
give me some false hope.
When I click on the full paths in the "make...directory" lines, I get
the correct dired buffers. This is good.
Alas, clicking on the warnings does not work: I am asked which file I
want to visit. This is no good. Emacs can figure out the full pathname
perfectly fine by parsing the "make...directory" lines.
Specifically, the last "Entering" line which is not matched with a
"Leaving" line points to "code/m2", so the first file "meng/book.h"
should be found in code/core/meng/book.h - and, lo and behold, it is there!



-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final)
http://openvotingconsortium.org http://iris.org.il
http://jihadwatch.org http://mideasttruth.com http://camera.org
I'd give my right arm to be ambidextrous.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8014: 24.0.50; compilation-mode does not track directories
  2011-02-10 17:11 bug#8014: 24.0.50; compilation-mode does not track directories Sam Steingold
@ 2011-02-17  2:53 ` Glenn Morris
  2011-03-12  4:30   ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2011-02-17  2:53 UTC (permalink / raw)
  To: 8014

Sam Steingold wrote:

> 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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8014: 24.0.50; compilation-mode does not track directories
  2011-02-17  2:53 ` Glenn Morris
@ 2011-03-12  4:30   ` Stefan Monnier
  2011-03-14 13:39     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-03-12  4:30 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 8014

>> 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)))))))






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8014: 24.0.50; compilation-mode does not track directories
  2011-03-12  4:30   ` Stefan Monnier
@ 2011-03-14 13:39     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-03-14 13:39 UTC (permalink / raw)
  To: 8014-done

So it seems fixed now,


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-14 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10 17:11 bug#8014: 24.0.50; compilation-mode does not track directories Sam Steingold
2011-02-17  2:53 ` Glenn Morris
2011-03-12  4:30   ` Stefan Monnier
2011-03-14 13:39     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.