[Top][All Lists]

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

Re: grep cannot find relative file names after save and re-open

From: Juri Linkov
Subject: Re: grep cannot find relative file names after save and re-open
Date: Tue, 16 Aug 2005 12:16:44 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> emacs -q 
> C-x C-f $YOUR_EMACE_SOURCE_TREE/lisp/ChangeLog RET
> M-x grep RET defface */*.el RET
> C-x C-w /tmp/TEST RET
> C-x k TEST RET 
> now open /tmp/TEST
> C-x C-f /tmp/TEST RET
> now move the cursor to one of the "calendar/calendar.el" lines and
> press RET
> at that point you are prompted to enter the file name where the file
> "calendar.el" is found.

The first line of the grep buffer (as well as the saved grep output)
contains the variable `default-directory', e.g.:

-*- mode: grep; default-directory: "/usr/share/emacs/lisp/" -*-

`grep-mode' uses the value of this variable to get the right
absolute file name from the relative name on compilation or grep
messages, and to store the absolute file name to the `message'
text property.  However, at the moment when it parses the grep
output, the variable `default-directory' from the first line has
no effect yet, because `grep-mode' from the first line is called
before setting the value of `default-directory'.

I see three solutions:

1. Set local variables specified in the -*- line before setting the
   mode from -*- mode tag.  This might have an undesirable effect on
   existing files where reversing the order of processing -*- line
   will lead to unpredictable consequences.

2. Set only `default-directory' specified in the -*- line before
   setting the mode, and to set the remaining variables later.

3. Change only compile.el to search for `default-directory' in the
   first line and to set its value exlicitly before staring to parse
   the compilation/grep output.

Juri Linkov

reply via email to

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