From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Glenn Morris <rgm@gnu.org>
Cc: 8014@debbugs.gnu.org
Subject: bug#8014: 24.0.50; compilation-mode does not track directories
Date: Fri, 11 Mar 2011 23:30:07 -0500 [thread overview]
Message-ID: <jwv39mtvu51.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <pf62sje5h9.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 16 Feb 2011 21:53:54 -0500")
>> 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)))))))
next prev parent reply other threads:[~2011-03-12 4:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2011-03-14 13:39 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv39mtvu51.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=8014@debbugs.gnu.org \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).