unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* grep-mode should print default-directory (again)
@ 2007-04-09 12:07 Nick Roberts
  2007-04-09 22:52 ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Roberts @ 2007-04-09 12:07 UTC (permalink / raw)
  To: emacs-devel


compilation-mode now sets compilation-directory and prints it as a file-local
variable.  ISTR it used to do this for default-directory.  grep-mode does the
same but, in this case I think default-directory is more relevant.


-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: grep-mode should print default-directory (again)
  2007-04-09 12:07 grep-mode should print default-directory (again) Nick Roberts
@ 2007-04-09 22:52 ` Richard Stallman
  2007-04-09 23:53   ` Nick Roberts
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-04-09 22:52 UTC (permalink / raw)
  To: Nick Roberts; +Cc: emacs-devel

    compilation-mode now sets compilation-directory and prints it as a file-local
    variable.  ISTR it used to do this for default-directory.  grep-mode does the
    same but, in this case I think default-directory is more relevant.

Could you explain why you think so?  Won't both achieve the same
result: finding the grep hits in the right place?

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

* Re: grep-mode should print default-directory (again)
  2007-04-09 22:52 ` Richard Stallman
@ 2007-04-09 23:53   ` Nick Roberts
  2007-04-13  1:42     ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Roberts @ 2007-04-09 23:53 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

 >     compilation-mode now sets compilation-directory and prints it as a
 >     file-local variable.  ISTR it used to do this for default-directory.
 >     grep-mode does the same but, in this case I think default-directory is
 >     more relevant.
 > 
 > Could you explain why you think so?  Won't both achieve the same
 > result: finding the grep hits in the right place?

AFAICS compilation-directory is just used with recompile and it gets set by
M-x compile (through default-directory).

If I do M-x compile when default-directory has the value "/home/nickrob/" I
get:

-*- mode: compilation; compilation-directory: "/home/nickrob/" -*-

If I then do M-x dired to another directory /home/nickrob/C say, then
default-directory has the value "/home/nickrob/C", but when I do grep from
there e.g

Run grep (like this): grep -nH -e enum *.c

I get:

-*- mode: grep; compilation-directory: "/home/nickrob/" -*-

but I want to know the directory that grep was started from.  Why should I
be interested in the current value of compilation-directory here?


-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: grep-mode should print default-directory (again)
  2007-04-09 23:53   ` Nick Roberts
@ 2007-04-13  1:42     ` Richard Stallman
  2007-04-13 13:49       ` Stefan Monnier
  2007-04-13 15:12       ` Chong Yidong
  0 siblings, 2 replies; 10+ messages in thread
From: Richard Stallman @ 2007-04-13  1:42 UTC (permalink / raw)
  To: Nick Roberts; +Cc: emacs-devel

    AFAICS compilation-directory is just used with recompile and it gets set by
    M-x compile (through default-directory).

Damn, you're right.  That means the change to set compilation-directory
instead of default-directory was no good.  It broke the feature.

I can see only two ways to fix this:

* Go back to setting and saving default-directory, as before, and mark
  it safe.  (I don't find the arguments against this entirely convincing.)

* Make compilation-directory affect next-error, overriding
  default-directory.

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

* Re: grep-mode should print default-directory (again)
  2007-04-13  1:42     ` Richard Stallman
@ 2007-04-13 13:49       ` Stefan Monnier
  2007-04-13 21:43         ` Richard Stallman
  2007-04-13 15:12       ` Chong Yidong
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2007-04-13 13:49 UTC (permalink / raw)
  To: rms; +Cc: Nick Roberts, emacs-devel

>     AFAICS compilation-directory is just used with recompile and it gets
>     set by M-x compile (through default-directory).

> Damn, you're right.  That means the change to set compilation-directory
> instead of default-directory was no good.  It broke the feature.

> I can see only two ways to fix this:

> * Go back to setting and saving default-directory, as before, and mark
>   it safe.  (I don't find the arguments against this entirely convincing.)

I personally find the arguments *for* it unconvincing.

> * Make compilation-directory affect next-error, overriding
>   default-directory.

Whatever happened to the other option:

* only add the default-directory cookie upon save and only when saving to
  a different directory.


        Stefan

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

* Re: grep-mode should print default-directory (again)
  2007-04-13  1:42     ` Richard Stallman
  2007-04-13 13:49       ` Stefan Monnier
@ 2007-04-13 15:12       ` Chong Yidong
  2007-04-13 19:10         ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2007-04-13 15:12 UTC (permalink / raw)
  To: rms; +Cc: Nick Roberts, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     AFAICS compilation-directory is just used with recompile and it gets set by
>     M-x compile (through default-directory).
>
> Damn, you're right.  That means the change to set compilation-directory
> instead of default-directory was no good.  It broke the feature.
>
> I can see only two ways to fix this:
>
> * Go back to setting and saving default-directory, as before, and mark
>   it safe.  (I don't find the arguments against this entirely convincing.)
>
> * Make compilation-directory affect next-error, overriding
>   default-directory.

I reverted to setting and saving default-directory.  I guess there is
the risk isn't considerable (or at least no worse than what we had in
Emacs 21).

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

* Re: grep-mode should print default-directory (again)
  2007-04-13 15:12       ` Chong Yidong
@ 2007-04-13 19:10         ` Stefan Monnier
  2007-04-13 21:54           ` Nick Roberts
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2007-04-13 19:10 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Nick Roberts, rms, emacs-devel

>> AFAICS compilation-directory is just used with recompile and it gets set by
>> M-x compile (through default-directory).
>> 
>> Damn, you're right.  That means the change to set compilation-directory
>> instead of default-directory was no good.  It broke the feature.
>> 
>> I can see only two ways to fix this:
>> 
>> * Go back to setting and saving default-directory, as before, and mark
>> it safe.  (I don't find the arguments against this entirely convincing.)
>> 
>> * Make compilation-directory affect next-error, overriding
>> default-directory.

> I reverted to setting and saving default-directory.  I guess there is
> the risk isn't considerable (or at least no worse than what we had in
> Emacs 21).

Huh?  In Emacs-21, the default-directory was not set, so it didn't suffer
from any of the nasty side effects of setting it.


        Stefan

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

* Re: grep-mode should print default-directory (again)
  2007-04-13 13:49       ` Stefan Monnier
@ 2007-04-13 21:43         ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2007-04-13 21:43 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: nickrob, emacs-devel

    Whatever happened to the other option:

    * only add the default-directory cookie upon save and only when saving to
      a different directory.

That is ok too.

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

* Re: grep-mode should print default-directory (again)
  2007-04-13 19:10         ` Stefan Monnier
@ 2007-04-13 21:54           ` Nick Roberts
  2007-04-15 13:59             ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Roberts @ 2007-04-13 21:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, rms, emacs-devel

 > > I reverted to setting and saving default-directory.  I guess there is
 > > the risk isn't considerable (or at least no worse than what we had in
 > > Emacs 21).
 > 
 > Huh?  In Emacs-21, the default-directory was not set, so it didn't suffer
 > from any of the nasty side effects of setting it.

default-directory is a buffer-local variable while compilation-directory is
not.  Why not just print default-directory at the top of the grep buffer
rather than make it file local (who saves these buffers anyway?).

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: grep-mode should print default-directory (again)
  2007-04-13 21:54           ` Nick Roberts
@ 2007-04-15 13:59             ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2007-04-15 13:59 UTC (permalink / raw)
  To: Nick Roberts; +Cc: cyd, monnier, emacs-devel

    default-directory is a buffer-local variable while compilation-directory is
    not.

Yes.

	  Why not just print default-directory at the top of the grep buffer
    rather than make it file local (who saves these buffers anyway?).

I put in the feature to make it a file local variable because I saved these
buffers -- in my home directory -- and found that finding the source files
didn't work right after I visited them again.

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

end of thread, other threads:[~2007-04-15 13:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-09 12:07 grep-mode should print default-directory (again) Nick Roberts
2007-04-09 22:52 ` Richard Stallman
2007-04-09 23:53   ` Nick Roberts
2007-04-13  1:42     ` Richard Stallman
2007-04-13 13:49       ` Stefan Monnier
2007-04-13 21:43         ` Richard Stallman
2007-04-13 15:12       ` Chong Yidong
2007-04-13 19:10         ` Stefan Monnier
2007-04-13 21:54           ` Nick Roberts
2007-04-15 13:59             ` Richard Stallman

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