unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* xref buffer and default-directory
@ 2021-01-08 17:15 Matthias Meulien
  2021-01-09  0:17 ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Matthias Meulien @ 2021-01-08 17:15 UTC (permalink / raw)
  To: emacs-devel

Hi, I am a heavy and happy user of project-find-regexp (through 
C-x p g).

Sometime while reading search results from the *xref* buffer I 
realize that I should perform another search; I thus press C-x p g 
again from the *xref* buffer. But it looks like the local value of 
default-directory isn't related to the last search context. And I 
am presented search results of an unrelated project. It's 
confusing and sometimes I take time to realize that am not reading 
the search results of the right project! Are you experiencing the 
same problem?

It looks like the value of default-directory for the *xref* buffer 
is not changed between searches. Is this correct? Should we change 
this behavior?
-- 
Matthias



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

* Re: xref buffer and default-directory
  2021-01-08 17:15 xref buffer and default-directory Matthias Meulien
@ 2021-01-09  0:17 ` Dmitry Gutov
  2021-01-09  9:46   ` Matthias Meulien
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dmitry Gutov @ 2021-01-09  0:17 UTC (permalink / raw)
  To: Matthias Meulien, emacs-devel

Hi Matthias,

On 08.01.2021 19:15, Matthias Meulien wrote:
> Hi, I am a heavy and happy user of project-find-regexp (through C-x p g).

Excellent!

> Sometime while reading search results from the *xref* buffer I realize 
> that I should perform another search; I thus press C-x p g again from 
> the *xref* buffer. But it looks like the local value of 
> default-directory isn't related to the last search context. And I am 
> presented search results of an unrelated project. It's confusing and 
> sometimes I take time to realize that am not reading the search results 
> of the right project! Are you experiencing the same problem?

Looks like I've never really tried this exact scenario before (I almost 
always search for the string at point, and that means switching to 
another buffer first).

> It looks like the value of default-directory for the *xref* buffer is 
> not changed between searches. Is this correct? Should we change this 
> behavior?

It was a bug (the default-directory value stayed on from the very first 
search you did in the current Emacs session). Should be fixed now in 
6e73e07a6f.

Thanks for the report.



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

* Re: xref buffer and default-directory
  2021-01-09  0:17 ` Dmitry Gutov
@ 2021-01-09  9:46   ` Matthias Meulien
  2021-02-03 17:16   ` Juri Linkov
  2021-02-04  1:41   ` Dmitry Gutov
  2 siblings, 0 replies; 9+ messages in thread
From: Matthias Meulien @ 2021-01-09  9:46 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

Dmitry Gutov <dgutov@yandex.ru> writes:

> It was a bug (the default-directory value stayed on from the 
> very first search you did in the current Emacs session). Should 
> be fixed now in 6e73e07a6f.

Yes, I confirm that now when project-find-regexp is called in an 
*xref* buffer the search happens in the expected project. 
> 
> Thanks for the report. 

Welcome!
-- 
Matthias



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

* Re: xref buffer and default-directory
  2021-01-09  0:17 ` Dmitry Gutov
  2021-01-09  9:46   ` Matthias Meulien
@ 2021-02-03 17:16   ` Juri Linkov
  2021-02-04  1:39     ` Dmitry Gutov
  2021-02-04  1:41   ` Dmitry Gutov
  2 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2021-02-03 17:16 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Matthias Meulien, emacs-devel

>> It looks like the value of default-directory for the *xref* buffer is not
>> changed between searches. Is this correct? Should we change
>> this behavior?
>
> It was a bug (the default-directory value stayed on from the very first
> search you did in the current Emacs session). Should be fixed now
> in 6e73e07a6f.

There is still a problem with this:

0. emacs -Q
1. C-x p g
2. Enter a regexp RET, then select a project directory
3. Check 'default-directory' in the xref buffer

It's still the directory of the initial *scratch* buffer,
not a project directory.



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

* Re: xref buffer and default-directory
  2021-02-03 17:16   ` Juri Linkov
@ 2021-02-04  1:39     ` Dmitry Gutov
  2021-02-04 17:02       ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2021-02-04  1:39 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Matthias Meulien, emacs-devel

Hi Juri,

On 03.02.2021 19:16, Juri Linkov wrote:
> There is still a problem with this:
> 
> 0. emacs -Q
> 1. C-x p g
> 2. Enter a regexp RET, then select a project directory
> 3. Check 'default-directory' in the xref buffer
> 
> It's still the directory of the initial*scratch*  buffer,
> not a project directory.

This is a slightly different scenario, requiring support from the 
command implementation. Should be better in c07ebfcbe0.



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

* Re: xref buffer and default-directory
  2021-01-09  0:17 ` Dmitry Gutov
  2021-01-09  9:46   ` Matthias Meulien
  2021-02-03 17:16   ` Juri Linkov
@ 2021-02-04  1:41   ` Dmitry Gutov
  2021-02-04 14:55     ` Eli Zaretskii
  2 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2021-02-04  1:41 UTC (permalink / raw)
  To: emacs-devel, Eli Zaretskii

On 09.01.2021 02:17, Dmitry Gutov wrote:
> 
> It was a bug (the default-directory value stayed on from the very first 
> search you did in the current Emacs session). Should be fixed now in 
> 6e73e07a6f.

I'd like to backport this to emacs-27. Eli, may I?

The most recent fix in this discussion (c07ebfcbe0) is less urgent, but 
I could add it too. Both patches are quite simple.



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

* Re: xref buffer and default-directory
  2021-02-04  1:41   ` Dmitry Gutov
@ 2021-02-04 14:55     ` Eli Zaretskii
  2021-02-04 20:37       ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2021-02-04 14:55 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Thu, 4 Feb 2021 03:41:40 +0200
> 
> On 09.01.2021 02:17, Dmitry Gutov wrote:
> > 
> > It was a bug (the default-directory value stayed on from the very first 
> > search you did in the current Emacs session). Should be fixed now in 
> > 6e73e07a6f.
> 
> I'd like to backport this to emacs-27. Eli, may I?
> 
> The most recent fix in this discussion (c07ebfcbe0) is less urgent, but 
> I could add it too. Both patches are quite simple.

OK for backporting both.

Thanks.



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

* Re: xref buffer and default-directory
  2021-02-04  1:39     ` Dmitry Gutov
@ 2021-02-04 17:02       ` Juri Linkov
  0 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2021-02-04 17:02 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Matthias Meulien, emacs-devel

>> There is still a problem with this:
>> 0. emacs -Q
>> 1. C-x p g
>> 2. Enter a regexp RET, then select a project directory
>> 3. Check 'default-directory' in the xref buffer
>> It's still the directory of the initial*scratch*  buffer,
>> not a project directory.
>
> This is a slightly different scenario, requiring support from the command
> implementation. Should be better in c07ebfcbe0.

Thanks, I confirm this is fixed.



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

* Re: xref buffer and default-directory
  2021-02-04 14:55     ` Eli Zaretskii
@ 2021-02-04 20:37       ` Dmitry Gutov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Gutov @ 2021-02-04 20:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 04.02.2021 16:55, Eli Zaretskii wrote:
>> I'd like to backport this to emacs-27. Eli, may I?
>>
>> The most recent fix in this discussion (c07ebfcbe0) is less urgent, but
>> I could add it too. Both patches are quite simple.
> OK for backporting both.
> 
> Thanks.

Done, thank you.



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

end of thread, other threads:[~2021-02-04 20:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 17:15 xref buffer and default-directory Matthias Meulien
2021-01-09  0:17 ` Dmitry Gutov
2021-01-09  9:46   ` Matthias Meulien
2021-02-03 17:16   ` Juri Linkov
2021-02-04  1:39     ` Dmitry Gutov
2021-02-04 17:02       ` Juri Linkov
2021-02-04  1:41   ` Dmitry Gutov
2021-02-04 14:55     ` Eli Zaretskii
2021-02-04 20:37       ` Dmitry Gutov

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