all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* current directory
@ 2006-10-18 21:52 help-gnu-emacs
  2006-10-18 22:32 ` Peter Dyballa
  0 siblings, 1 reply; 28+ messages in thread
From: help-gnu-emacs @ 2006-10-18 21:52 UTC (permalink / raw)



This is about unix-like environment.

Say I start emacs with a file in a certain directory, say /a/b/c:

cd ~
emacs /a/b/c/file

then, while in emacs, I open another file, say /g/d/f/file1.

It looks like after this emacs moves its "current directory" to /g/d/f. Now, if I start a shell script through call-process, the shell script's current directory is also /g/d/f, but it depends on being run somewhere in /a/b/c tree.
In fact, it looks like emacs changes its internal 'current directory' each time I switch to a file in a different directory, even a previously opened file.

Is there a way to prevent emacs from changing its current directory when opening a new file or changing between files being visited?

TIA,
/vb

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

* Re: current directory
  2006-10-18 21:52 help-gnu-emacs
@ 2006-10-18 22:32 ` Peter Dyballa
  2006-10-18 23:12   ` vb
  0 siblings, 1 reply; 28+ messages in thread
From: Peter Dyballa @ 2006-10-18 22:32 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 18.10.2006 um 23:52 schrieb help-gnu-emacs@vsbe.com:

> Is there a way to prevent emacs from changing its current directory  
> when opening a new file or changing between files being visited?

Why? For what?

--
Greetings

   Pete

"Specifications are for the weak and timid!"

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

* Re: current directory
  2006-10-18 22:32 ` Peter Dyballa
@ 2006-10-18 23:12   ` vb
  2006-10-19  4:25     ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: vb @ 2006-10-18 23:12 UTC (permalink / raw)


On Wednesday 18 October 2006 15:32, you wrote:
> Am 18.10.2006 um 23:52 schrieb help-gnu-emacs@vsbe.com:
> > Is there a way to prevent emacs from changing its current directory
> > when opening a new file or changing between files being visited?
>
> Why? For what?
>
as I mentioned in the original email:

> Now, if I start a shell script through call-process, the shell script's
> current directory is also /g/d/f

the script finds the ID database in the current directory tree and then looks 
up a token in the database. If current directory changed to a different tree, 
the ID database is not seen by the script.

I think this is one of the examples when emacs is overdoing its stuff - it 
should have no business changing user's current directory or at least allow 
to configure this behavior.

cheers,
/vb

> --
> Greetings
>
>    Pete
>
> "Specifications are for the weak and timid!"

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

* Re: current directory
  2006-10-18 23:12   ` vb
@ 2006-10-19  4:25     ` Eli Zaretskii
  0 siblings, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2006-10-19  4:25 UTC (permalink / raw)


> From: vb <help-gnu-emacs@vsbe.com>
> Date: Wed, 18 Oct 2006 16:12:02 -0700
> 
> On Wednesday 18 October 2006 15:32, you wrote:
> > Am 18.10.2006 um 23:52 schrieb help-gnu-emacs@vsbe.com:
> > > Is there a way to prevent emacs from changing its current directory
> > > when opening a new file or changing between files being visited?
> >
> > Why? For what?
> >
> as I mentioned in the original email:
> 
> > Now, if I start a shell script through call-process, the shell script's
> > current directory is also /g/d/f
> 
> the script finds the ID database in the current directory tree and then looks 
> up a token in the database. If current directory changed to a different tree, 
> the ID database is not seen by the script.

The current directory is different for each buffer.  If you want the
script to do the right thing for the file /a/b/c/file, start the
script from the buffer which visits that file, not from the buffer
that visits /g/d/f/file1.

> I think this is one of the examples when emacs is overdoing its stuff - it 
> should have no business changing user's current directory or at least allow 
> to configure this behavior.

You are wrong: Emacs does _exactly_ what the user expects: all
operations from a buffer that visits a file assume the default
directory is the directory of that file.  This is not a global value,
each buffer has its own setting of the default directory.

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

* Re: current directory
@ 2006-10-19  5:16 help-gnu-emacs
  2006-10-20  5:49 ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: help-gnu-emacs @ 2006-10-19  5:16 UTC (permalink / raw)



> 
> The current directory is different for each buffer.  If you want the
> script to do the right thing for the file /a/b/c/file, start the
> script from the buffer which visits that file, not from the buffer
> that visits /g/d/f/file1.
>

Eli, thank you, I figured this much. So, if I want to look up a variable which is in /a/b/c/file, but the ID file is in the /g/d/f tree - I am screwed.

>> I think this is one of the examples when emacs is overdoing its stuff - it 
>> should have no business changing user's current directory or at least allow 
>> to configure this behavior.
> 
> You are wrong: Emacs does _exactly_ what the user expects: all
> operations from a buffer that visits a file assume the default
> directory is the directory of that file.  This is not a global value,
> each buffer has its own setting of the default directory.
>

Well, what makes you think that you can speak for all users? Am I not a user?  I sure don't expect an editor to do it, no other editor I came across in almost 20 years suffers from this malaise. If someone thinks this behavior is a benefit - at the very least leave the backdoor open to those ho doesn't.

cheers,
/vb

> 
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>

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

* Re: current directory
       [not found] <mailman.83.1161235004.2130.help-gnu-emacs@gnu.org>
@ 2006-10-19 16:01 ` Fang lun gang
  2006-10-19 16:52   ` vb
       [not found]   ` <mailman.100.1161276782.2130.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 28+ messages in thread
From: Fang lun gang @ 2006-10-19 16:01 UTC (permalink / raw)


>>>>> "help-gnu-emacs" == help-gnu-emacs  <help-gnu-emacs@vsbe.com> writes:

    >> 
    >> The current directory is different for each buffer.  If you want the
    >> script to do the right thing for the file /a/b/c/file, start the script
    >> from the buffer which visits that file, not from the buffer that visits
    >> /g/d/f/file1.
    >> 

Eli, thank you, I figured this much. So, if I want to look up a variable which is in /a/b/c/file, but the ID file is in the /g/d/f tree - I am screwed.

    >>> I think this is one of the examples when emacs is overdoing its stuff -
    >>> it should have no business changing user's current directory or at least
    >>> allow to configure this behavior.
    >> 
    >> You are wrong: Emacs does _exactly_ what the user expects: all operations
    >> from a buffer that visits a file assume the default directory is the
    >> directory of that file.  This is not a global value, each buffer has its
    >> own setting of the default directory.
    >> 

Well, what makes you think that you can speak for all users? Am I not a user?  I sure don't expect an editor to do it, no other editor I came across in almost 20 years suffers from this malaise. If someone thinks this behavior is a benefit - at the very least leave the backdoor open to those ho doesn't.

    help-gnu-emacs> cheers, /vb

    >> 
    >> _______________________________________________ help-gnu-emacs mailing
    >> list help-gnu-emacs@gnu.org
    >> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
    >> 

Maybe in your case, emacs did to much. But emacs can only choose a policy that
preferred by most people in most cases. 

I guess you would appreciate almost everything it does for you if you come to
understand emacs. At least I do.

-- 
Regards,
Fang lun gang

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

* Re: current directory
  2006-10-19 16:01 ` Fang lun gang
@ 2006-10-19 16:52   ` vb
  2006-10-20  6:22     ` Eli Zaretskii
       [not found]   ` <mailman.100.1161276782.2130.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 28+ messages in thread
From: vb @ 2006-10-19 16:52 UTC (permalink / raw)


On Thursday 19 October 2006 09:01, Fang lun gang wrote:

>
> Maybe in your case, emacs did to much. But emacs can only choose a policy
> that preferred by most people in most cases.
>
> I guess you would appreciate almost everything it does for you if you come
> to understand emacs. At least I do.

well, this is becoming a philosophical issue, but I'll comment on it anyways: 
as soon as somebody gets to decide what is good for other people, the other 
people are in trouble.

Again, I am all for emacs doing whatever whoever thinks is good. But let those 
who feel otherwise do what they want - otherwise this is like a communist 
society: driving people to their happiness with an iron fist.

BTW, there is another annoying feature which I don't know how to deal with - 
maybe there is a way around it:

say I am editing a file which is longer than a few screenfulls. I hit the 
'page up' key a few times, and then hit the 'page down' key the same number 
of times. I get back the screen there was originally, but the cursor now is 
in the first line, not where it was before these page scrolls. 

Is there any way to preserve the cursor position? Again, pretty much any other 
editor I dealt with preserves the position in this situation...

cheers,
/vb

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

* Re: current directory
       [not found]   ` <mailman.100.1161276782.2130.help-gnu-emacs@gnu.org>
@ 2006-10-19 19:22     ` rgb
  2006-10-19 21:00       ` vb
  2006-10-21 18:38     ` don provan
  1 sibling, 1 reply; 28+ messages in thread
From: rgb @ 2006-10-19 19:22 UTC (permalink / raw)




> say I am editing a file which is longer than a few screenfulls. I hit the
> 'page up' key a few times, and then hit the 'page down' key the same number
> of times. I get back the screen there was originally, but the cursor now is
> in the first line, not where it was before these page scrolls.

(setq scroll-preserve-screen-position t)

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

* Re: current directory
  2006-10-19 19:22     ` rgb
@ 2006-10-19 21:00       ` vb
  0 siblings, 0 replies; 28+ messages in thread
From: vb @ 2006-10-19 21:00 UTC (permalink / raw)
  Cc: rgb

On Thursday 19 October 2006 12:22, rgb wrote:
> (setq scroll-preserve-screen-position t)

This is almost exactly what I needed (still moves the cursor to the beginning 
of the line, but that's such a minor thing).

Thanks a lot!

cheers,
/vb

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

* Re: current directory
  2006-10-19  5:16 current directory help-gnu-emacs
@ 2006-10-20  5:49 ` Eli Zaretskii
  0 siblings, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2006-10-20  5:49 UTC (permalink / raw)


> From: help-gnu-emacs@vsbe.com
> Cc: eliz@gnu.org
> Date: Thu, 19 Oct 2006 01:16:32 -0400
> 
> > The current directory is different for each buffer.  If you want the
> > script to do the right thing for the file /a/b/c/file, start the
> > script from the buffer which visits that file, not from the buffer
> > that visits /g/d/f/file1.
> 
> Eli, thank you, I figured this much. So, if I want to look up a variable which is in /a/b/c/file, but the ID file is in the /g/d/f tree - I am screwed.

That is a different situation than the one you described in your
original message.  The original message said the problem was that
Emacs would behave as if the current directory were /g/d/f, which was
on another filesystem from /a/b/c, and that the script needed to be
run in the /a/b/c tree.  Now you are saying something different.

Could you please describe the situation more completely?
Specifically, how do you invoke the script from the shell's prompt,
and from which directory; and how doing that from Emacs screws what
you are used to doing outside Emacs?  I'm sure there's a simple
solution to your problems, but I cannot suggest a solution if the
problem keeps changing under my feet.

> > You are wrong: Emacs does _exactly_ what the user expects: all
> > operations from a buffer that visits a file assume the default
> > directory is the directory of that file.  This is not a global value,
> > each buffer has its own setting of the default directory.
> >
> 
> Well, what makes you think that you can speak for all users?

Because complaints about the current behavior are extremely rare, if
not absent.

> I sure don't expect an editor to do it, no other editor I came across in almost 20 years suffers from this malaise.

Emacs does many things other editors don't -- this is what makes it so
outstandingly good.

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

* Re: current directory
  2006-10-19 16:52   ` vb
@ 2006-10-20  6:22     ` Eli Zaretskii
  0 siblings, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2006-10-20  6:22 UTC (permalink / raw)


> From: vb <help-gnu-emacs@vsbe.com>
> Date: Thu, 19 Oct 2006 09:52:48 -0700
> 
> well, this is becoming a philosophical issue, but I'll comment on it anyways: 
> as soon as somebody gets to decide what is good for other people, the other 
> people are in trouble.

Not unless that decision is tested by 20 years of user satisfaction.

> Again, I am all for emacs doing whatever whoever thinks is good. But let those 
> who feel otherwise do what they want - otherwise this is like a communist 
> society: driving people to their happiness with an iron fist.

You are free to modify Emacs to your liking: it's infinitely
customizable, and if that isn't enough, the sources are freely
available to be hacked as you wish.

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

* Re: current directory
       [not found] <mailman.74.1161208352.2130.help-gnu-emacs@gnu.org>
@ 2006-10-20 16:46 ` Sam Peterson
  0 siblings, 0 replies; 28+ messages in thread
From: Sam Peterson @ 2006-10-20 16:46 UTC (permalink / raw)


>>>>> "help-gnu-emacs" == help-gnu-emacs  <help-gnu-emacs@vsbe.com> writes:

    > This is about unix-like environment.

    > Say I start emacs with a file in a certain directory, say
    > /a/b/c:

    > cd ~ emacs /a/b/c/file

    > then, while in emacs, I open another file, say /g/d/f/file1.

    > It looks like after this emacs moves its "current directory" to
    > /g/d/f. Now, if I start a shell script through call-process, the
    > shell script's current directory is also /g/d/f, but it depends
    > on being run somewhere in /a/b/c tree.  In fact, it looks like
    > emacs changes its internal 'current directory' each time I
    > switch to a file in a different directory, even a previously
    > opened file.

    > Is there a way to prevent emacs from changing its current
    > directory when opening a new file or changing between files
    > being visited?

    > TIA, /vb

To my knowledge, the working directory of the process is not changed
per se, rather, rather the value of the lisp variable
default-directory is different in each buffer.

There may be a way to set this variable in find-file-hooks, although
there's a chance there could be an awful lot of plumbing in Emacs that
assumes default-directory contains the name of the directory that the
current buffer's file refers to.  Worth a shot anyway.

(add-hook 'find-file-hooks
  (lambda () (setq default-directory "dir-name"))

This of course statically sets it.  I'm sure there's a way through the
magic of elisp to set the hook so it uses the dir of the requested
file.  Any suggestions elisp gurus?

The preferred way in the GNU Emacs world is to just deal with shell
commands via a shell buffer.  If you absolutely need to to use M-! for
whatever reason, whether that be to just run something quickly or
insert the output in the current buffer, shell-mode plus
killing/yanking text via a macro is one way I often go about it.

There is almost always a back-door in Emacs.  It can require writing
an awful lot of elisp sometimes though ;).

-- 
Sam Peterson
skpeterson At nospam ucdavis.edu
"if programmers were paid to remove code instead of adding it,
software would be much better" -- unknown

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

* Re: current directory
       [not found]   ` <mailman.100.1161276782.2130.help-gnu-emacs@gnu.org>
  2006-10-19 19:22     ` rgb
@ 2006-10-21 18:38     ` don provan
  2006-10-23 17:24       ` vb
       [not found]       ` <mailman.166.1161624291.27805.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 28+ messages in thread
From: don provan @ 2006-10-21 18:38 UTC (permalink / raw)


vb <help-gnu-emacs@vsbe.com> writes:

> well, this is becoming a philosophical issue, but I'll comment on it
> anyways: as soon as somebody gets to decide what is good for other
> people, the other people are in trouble.

LOL! You obviously aren't very familiar with emacs! Emacs provides all
manner of options for adjusting anything to any behavior that's ever
been suggested by anyone for any reason. And then *on top of that* you
can implement any changes, improvements, or additions with a little
lisp code.

But the fact is that *something* has to be the default behavior, and
in this case, the per-buffer current directory is an outstanding
choice. The only reason it might give people some trouble is that more
trivial editors encourage you to invoke the editor one time for one
file, and then invoke it again for another file, etc., so that there's
a one-to-one correspondence between editor session and file. Emacs is
a development system, so most people use it to look at or modify many
files in any given session. (Some people go so far as to use a single
emacs sessions as their *entire user environment* and don't do
*anything* outside emacs!) In that situation, it would be *insane* to
insist that the user keep in mind some arbitrary "current directory"
based on how emacs was invoked the very first time when there's a very
specific and obvious directory location staring the user in the face.

> Again, I am all for emacs doing whatever whoever thinks is good. But
> let those who feel otherwise do what they want - otherwise this is
> like a communist society: driving people to their happiness with an
> iron fist.

Fight on, Dude!

> say I am editing a file which is longer than a few screenfulls. I
> hit the 'page up' key a few times, and then hit the 'page down' key
> the same number of times. I get back the screen there was
> originally, but the cursor now is in the first line, not where it
> was before these page scrolls.

I'm not sure what editor you're thinking of, but what the other
editors I'm familiar with do is leave the cursor on a page that you
aren't currently looking at, making it amusing and confusing when you
issue a command that actually depends on a cursor location that is not
long in view. While someone mentioned a workaround, really the problem
is that you aren't using the editor to accomplish what *you* want.
Isn't what you really want to do hold your place with a finger, go off
and look at something somewhere else, and then return to your finger?
Emacs provides "marks" to do exactly that, so you can return to
exactly the original spot with a single command rather than manually
returning the view back to the original location by remembering how
many pages you've moved up or down and issuing that many page movement
command to get back.

Or, to summarize, you seem to have been trained by simple editors and
developed techniques to deal with them because they're so stupid. You
might want to -- but I'm not forcing you! -- step back and think about
what *you* really want to do when you're editing, and I wonder if you
won't find that emacs provides a easy way to do *that* rather than an
way to continue jumping through the hoops that your old editor taught
you to jump through. You might find that the real bad guy here is your
old editor....

-don

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

* Re: current directory
  2006-10-21 18:38     ` don provan
@ 2006-10-23 17:24       ` vb
  2006-10-23 19:17         ` John Sullivan
                           ` (2 more replies)
       [not found]       ` <mailman.166.1161624291.27805.help-gnu-emacs@gnu.org>
  1 sibling, 3 replies; 28+ messages in thread
From: vb @ 2006-10-23 17:24 UTC (permalink / raw)
  Cc: don provan

On Saturday 21 October 2006 11:38, don provan wrote:
> vb <help-gnu-emacs@vsbe.com> writes:
> > well, this is becoming a philosophical issue, but I'll comment on it
> > anyways: as soon as somebody gets to decide what is good for other
> > people, the other people are in trouble.
>
> LOL! You obviously aren't very familiar with emacs! Emacs provides all
> manner of options for adjusting anything to any behavior that's ever
> been suggested by anyone for any reason. And then *on top of that* you
> can implement any changes, improvements, or additions with a little
> lisp code.
>

Well, indeed I am not very familiar with emacs - I've been using commercial 
products for long time, but changed employer recently and now have to use 
this "free" product.

> But the fact is that *something* has to be the default behavior, and
> in this case, the per-buffer current directory is an outstanding
> choice. The only reason it might give people some trouble is that more
> trivial editors encourage you to invoke the editor one time for one
> file, and then invoke it again for another file, etc., so that there's
> a one-to-one correspondence between editor session and file. 

oh, well, it obviously has been a very long time since looked around beyond 
your beloved emacs. Pretty much any editor these days allows to edit more 
than one file at a time.

> Emacs is 
> a development system, so most people use it to look at or modify many
> files in any given session. (Some people go so far as to use a single
> emacs sessions as their *entire user environment* and don't do
> *anything* outside emacs!) 

And I feel sorry for these people :-)

> In that situation, it would be *insane* to 
> insist that the user keep in mind some arbitrary "current directory"
> based on how emacs was invoked the very first time when there's a very
> specific and obvious directory location staring the user in the face.
>

no, it would not be insane at all. All other editors but emacs I am used to 
maintain a notion of "current directory" and allow the user to change this 
current directory explicitly. The fact that emacs doesn't even have an 
infrastructure for that just shows how off mark its approach is.

> > Again, I am all for emacs doing whatever whoever thinks is good. But
> > let those who feel otherwise do what they want - otherwise this is
> > like a communist society: driving people to their happiness with an
> > iron fist.
>
> Fight on, Dude!
>
> > say I am editing a file which is longer than a few screenfulls. I
> > hit the 'page up' key a few times, and then hit the 'page down' key
> > the same number of times. I get back the screen there was
> > originally, but the cursor now is in the first line, not where it
> > was before these page scrolls.
>
> I'm not sure what editor you're thinking of, but what the other
> editors I'm familiar with do is leave the cursor on a page that you
> aren't currently looking at, making it amusing and confusing when you
> issue a command that actually depends on a cursor location that is not
> long in view.

As I said, look around, check out Crisp for instance, you would be surprised: 
no long keystrokes, much wider use of keys (say astersk on the numeric keypad 
and on the main keyboard are naturally assigned to different key codes _ 
still have to find the way to achieve this with emacs, and I've tried!). You 
can write macros in object oriented c-like language, not in this weird lisp 
which is a remnant of computing stone age (I know, I know that it is still 
used to teach students).

Again, what's the point of moving the cursor to  the first line of the screen 
when somebody does page up/page down sequence? I know about setting the mark 
thing someone suggested here, but why would one need to hit extra keystrokes 
- it is only natural to hit a key a few times and hit an opposite action key 
for a few times and return exactly to the state you were when you started.

This works with arrow left/right, arrow up/down, but doesn't with page up/down 
- this is just inconsistent and shows the lack of thought of the editor  
designer.

> While someone mentioned a workaround, really the problem 
> is that you aren't using the editor to accomplish what *you* want.
> Isn't what you really want to do hold your place with a finger, go off
> and look at something somewhere else, and then return to your finger?
> Emacs provides "marks" to do exactly that, so you can return to
> exactly the original spot with a single command rather than manually
> returning the view back to the original location by remembering how
> many pages you've moved up or down and issuing that many page movement
> command to get back.
>

as I said, I know about the marks, what I intuitively want is that if I make a 
few steps in one direction, and then a few steps in the opposite direction - 
I end up exactly where I started.

> Or, to summarize, you seem to have been trained by simple editors and
> developed techniques to deal with them because they're so stupid. 

Oh, let me repeat myself, you seem to have been stuck with emacs not seeing 
all other ideas and approaches there are around.

The only advantage of emacs is that it is free. All my colleagues who are 
using it (and I have seen many tens of those in years) use it with very 
little modifications, never know how to do even simple things beyond the very 
basic functions.

I just made an effort to learn lisp and am just now starting to see some ways 
of making this editor to do what I want, but boy do I consider this time 
wasted - I should have payed for my personal copy of Crisp instead ;-)

> You 
> might want to -- but I'm not forcing you! -- step back and think about
> what *you* really want to do when you're editing, and I wonder if you
> won't find that emacs provides a easy way to do *that* rather than an
> way to continue jumping through the hoops that your old editor taught
> you to jump through. You might find that the real bad guy here is your
> old editor....
>
> -don
> 
Don, all being said, I really appreciate your effort and suggestions, I sure 
don't want to discourage anyone from using emacs, I just want you hard core 
emacs guys recognize that there is life outside emacs :-)

cheers,
/vb


> _______________________________________________ 
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: current directory
       [not found]       ` <mailman.166.1161624291.27805.help-gnu-emacs@gnu.org>
@ 2006-10-23 17:48         ` David Kastrup
  2006-10-23 20:03           ` Eli Zaretskii
  2006-10-23 18:33         ` Colin S. Miller
  1 sibling, 1 reply; 28+ messages in thread
From: David Kastrup @ 2006-10-23 17:48 UTC (permalink / raw)


vb <help-gnu-emacs@vsbe.com> writes:

> On Saturday 21 October 2006 11:38, don provan wrote:
>
>> Emacs is a development system, so most people use it to look at or
>> modify many files in any given session. (Some people go so far as
>> to use a single emacs sessions as their *entire user environment*
>> and don't do *anything* outside emacs!)
>
> And I feel sorry for these people :-)

Well, a lot of people feel sorry for me when they see me going
everywhere by bicycle when I would have the option to work two hours
longer a day in order to afford a car that saves me something like 30
minutes of driving so that I can get faster to a gym in the evening in
order to get the exercise I am missing throughout the day.

Modern lifestyle is completely wacko.  And modern desktops feel like a
microcosmos of modern life.

Take something like a battery applet in a taskbar.  It does not cost
more than a few megabytes of memory, talks through Corba methods and
other smart stuff to the taskbar and probably takes just some
expendible amount of CPU time.  The equivalent applet in Emacs takes a
few _kilo_ bytes of memory (if at all) and no noticeable CPU impact.

People talk about the "bloat" of Emacs.  When I work with a typical
Emacs session (I am lazy and keep sessions over logouts), Emacs has
probably something like 30-40MB memory impact when used with AUCTeX,
preview-latex, editing several directories, CVS support etc etc.  Now
starting a simple, "unbloated" KDE TeX environment like Kate(?) will
fire up 90MBs of libraries, demons and whatnots before I even load a
single file.

>> In that situation, it would be *insane* to insist that the user
>> keep in mind some arbitrary "current directory" based on how emacs
>> was invoked the very first time when there's a very specific and
>> obvious directory location staring the user in the face.
>>
>
> no, it would not be insane at all. All other editors but emacs I am
> used to maintain a notion of "current directory" and allow the user
> to change this current directory explicitly.

"All others" is not synonymous with "sane" in my book.

> Don, all being said, I really appreciate your effort and
> suggestions, I sure don't want to discourage anyone from using
> emacs, I just want you hard core emacs guys recognize that there is
> life outside emacs :-)

Oh, sure, nobody denies that.  It just sucks in comparison.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: current directory
       [not found]       ` <mailman.166.1161624291.27805.help-gnu-emacs@gnu.org>
  2006-10-23 17:48         ` David Kastrup
@ 2006-10-23 18:33         ` Colin S. Miller
  2006-10-23 18:58           ` vb
       [not found]           ` <mailman.169.1161629903.27805.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 28+ messages in thread
From: Colin S. Miller @ 2006-10-23 18:33 UTC (permalink / raw)


vb wrote:
> On Saturday 21 October 2006 11:38, don provan wrote:
> 
> no, it would not be insane at all. All other editors but emacs I am used to 
> maintain a notion of "current directory" and allow the user to change this 
> current directory explicitly. The fact that emacs doesn't even have an 
> infrastructure for that just shows how off mark its approach is.
> 

I find it interesting to note that in MS VC 6,
File/Open defaulted to the last directory you open a file from,
and MS VC .NET now defaults to the directory of the current file.

> 
> As I said, look around, check out Crisp for instance, you would be surprised: 
> no long keystrokes, much wider use of keys (say astersk on the numeric keypad 
> and on the main keyboard are naturally assigned to different key codes _ 
> still have to find the way to achieve this with emacs, and I've tried!). You 
> can write macros in object oriented c-like language, not in this weird lisp 
> which is a remnant of computing stone age (I know, I know that it is still 
> used to teach students).

(global-set-key 'kp-multiply 'switch-to-buffer)

C-h k *  indicates the internal name for keystrokes


BTW,
in answer to your original question,
you could make the call-progress run
"cd  /a/b/c && ./myScript.sh"

It is possible for emacs to record its starting directory,
and add the cd for you.


HTH,
Colin S. Miller
-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.

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

* Re: current directory
  2006-10-23 18:33         ` Colin S. Miller
@ 2006-10-23 18:58           ` vb
       [not found]           ` <mailman.169.1161629903.27805.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 28+ messages in thread
From: vb @ 2006-10-23 18:58 UTC (permalink / raw)
  Cc: Colin S. Miller

Colin,

thank you for your suggestions, please see below:

On Monday 23 October 2006 11:33, Colin S. Miller wrote:
> vb wrote:
> > On Saturday 21 October 2006 11:38, don provan wrote:
> >
> > no, it would not be insane at all. All other editors but emacs I am used
> > to maintain a notion of "current directory" and allow the user to change
> > this current directory explicitly. The fact that emacs doesn't even have
> > an infrastructure for that just shows how off mark its approach is.
>
> I find it interesting to note that in MS VC 6,
> File/Open defaulted to the last directory you open a file from,
> and MS VC .NET now defaults to the directory of the current file.
>

oh well, they don't get any smarter then, do they ;-). 

> > As I said, look around, check out Crisp for instance, you would be
> > surprised: no long keystrokes, much wider use of keys (say astersk on the
> > numeric keypad and on the main keyboard are naturally assigned to
> > different key codes _ still have to find the way to achieve this with
> > emacs, and I've tried!). You can write macros in object oriented c-like
> > language, not in this weird lisp which is a remnant of computing stone
> > age (I know, I know that it is still used to teach students).
>
> (global-set-key 'kp-multiply 'switch-to-buffer)
>
> C-h k *  indicates the internal name for keystrokes
>

I tried that, and for some reason this is what I get when I hit the C-h k 
'keypad asterisk':
=====================================================
* runs the command c-electric-star
   which is an interactive compiled Lisp function in `cc-cmds'.
(c-electric-star ARG)

Insert a star character.
If the star is the second character of a C style comment introducing
construct, and we are on a comment-only-line, indent line as comment.
If a numeric ARG is supplied, point is inside a literal, or
`c-syntactic-indentation' is nil, indentation is inhibited.
======================================================

and this is what I get when hitting the asterisk on the same key with '8':

======================================================
* runs the command self-insert-command
(self-insert-command N)
   which is an interactive built-in function.

Insert the character you type.
Whichever character you type to run this command is inserted.
======================================================

for some reason the both keys are called the same (*), but have different 
functions assigned - somewhat confusing (to me anyway)

>
> BTW,
> in answer to your original question,
> you could make the call-progress run
> "cd  /a/b/c && ./myScript.sh"
>

yes, this is exactly what I was looking for - I did not know how far 
'call-process' would go to allow to invoke two commands instead of one and 
did not try different variants.

> It is possible for emacs to record its starting directory,
> and add the cd for you.
>
>
> HTH,

It sure does, thank you again for this suggestion, 

cheers,

/vb

> Colin S. Miller

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

* Re: current directory
  2006-10-23 17:24       ` vb
@ 2006-10-23 19:17         ` John Sullivan
  2006-10-23 19:57         ` Eli Zaretskii
  2006-10-23 20:32         ` Kevin Rodgers
  2 siblings, 0 replies; 28+ messages in thread
From: John Sullivan @ 2006-10-23 19:17 UTC (permalink / raw)


vb <help-gnu-emacs@vsbe.com> writes:

> no, it would not be insane at all. All other editors but emacs I am used to 
> maintain a notion of "current directory" and allow the user to change this 
> current directory explicitly. The fact that emacs doesn't even have an 
> infrastructure for that just shows how off mark its approach is.
>

M-x cd

But anyway, I find it quite common in applications of all types to have the
default directory in any file chooser be determined by some method -- often,
the default directory starts with whatever directory you chose the last time
you used the chooser.

I think the emacs behavior of having the default directory be the directory
where the file currently being accessed lives is sensible.

You do know that if you just type a / after the default input, you are back at
root again, right? You don't even have to delete the default text that emacs
inserts in the minibuffer.  

-- 
-John Sullivan
-http://www.wjsullivan.net
-GPG Key: AE8600B6

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

* Re: current directory
       [not found]           ` <mailman.169.1161629903.27805.help-gnu-emacs@gnu.org>
@ 2006-10-23 19:46             ` Peter Boettcher
  0 siblings, 0 replies; 28+ messages in thread
From: Peter Boettcher @ 2006-10-23 19:46 UTC (permalink / raw)


vb <help-gnu-emacs@vsbe.com> writes:

> On Monday 23 October 2006 11:33, Colin S. Miller wrote:
>
>>
>> in answer to your original question,
>> you could make the call-progress run
>> "cd  /a/b/c && ./myScript.sh"
>
> yes, this is exactly what I was looking for - I did not know how far 
> 'call-process' would go to allow to invoke two commands instead of one and 
> did not try different variants.

I don't think anyone has yet mentioned

M-x cd <my_directory> RET


-Peter

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

* Re: current directory
  2006-10-23 17:24       ` vb
  2006-10-23 19:17         ` John Sullivan
@ 2006-10-23 19:57         ` Eli Zaretskii
  2006-10-23 20:36           ` vb
       [not found]           ` <mailman.178.1161635783.27805.help-gnu-emacs@gnu.org>
  2006-10-23 20:32         ` Kevin Rodgers
  2 siblings, 2 replies; 28+ messages in thread
From: Eli Zaretskii @ 2006-10-23 19:57 UTC (permalink / raw)


> From: vb <help-gnu-emacs@vsbe.com>
> Date: Mon, 23 Oct 2006 10:24:36 -0700
> Cc: don provan <dprovan@comcast.net>
> 
> All other editors but emacs I am used to 
> maintain a notion of "current directory" and allow the user to change this 
> current directory explicitly. The fact that emacs doesn't even have an 
> infrastructure for that just shows how off mark its approach is.

If I understand you correctly, you think that Emacs doesn't have a way
of letting you change the current directory.  That is false: the
command `M-x cd' will do just that.

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

* Re: current directory
  2006-10-23 17:48         ` David Kastrup
@ 2006-10-23 20:03           ` Eli Zaretskii
  0 siblings, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2006-10-23 20:03 UTC (permalink / raw)


> From: David Kastrup <dak@gnu.org>
> Date: Mon, 23 Oct 2006 19:48:26 +0200
> 
> Take something like a battery applet in a taskbar.  It does not cost
> more than a few megabytes of memory, talks through Corba methods and
> other smart stuff to the taskbar and probably takes just some
> expendible amount of CPU time.

To say nothing of the battery power it sucks up ;-)

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

* Re: current directory
  2006-10-23 17:24       ` vb
  2006-10-23 19:17         ` John Sullivan
  2006-10-23 19:57         ` Eli Zaretskii
@ 2006-10-23 20:32         ` Kevin Rodgers
  2006-10-23 20:59           ` vb
  2 siblings, 1 reply; 28+ messages in thread
From: Kevin Rodgers @ 2006-10-23 20:32 UTC (permalink / raw)


vb wrote:
> As I said, look around, check out Crisp for instance, you would be surprised: 

`C-h a crisp RET' yields:

crisp-mode		      M-x ... RET
   Command: Toggle CRiSP/Brief emulation minor mode.

And here's what the Emulation node of the Emacs manual says about it:

CRiSP/Brief (PC editor)
      You can turn on key bindings to emulate the CRiSP/Brief editor with
      `M-x crisp-mode'.  Note that this rebinds `M-x' to exit Emacs
      unless you set the variable `crisp-override-meta-x'.  You can also
      use the command `M-x scroll-all-mode' or set the variable
      `crisp-load-scroll-all' to emulate CRiSP's scroll-all feature
      (scrolling all windows together).

> no long keystrokes, much wider use of keys (say astersk on the numeric keypad 
> and on the main keyboard are naturally assigned to different key codes _ 
> still have to find the way to achieve this with emacs, and I've tried!).

The "Rebinding Function Keys" node of the Emacs manual says:

`kp-add', `kp-subtract', `kp-multiply', `kp-divide'
`kp-backtab', `kp-space', `kp-tab', `kp-enter'
`kp-separator', `kp-decimal', `kp-equal'
      Keypad keys (to the right of the regular keyboard), with names or
      punctuation.

`kp-0', `kp-1', ... `kp-9'
      Keypad keys with digits.

So: (global-set-key [kp-multiply] 'some-useful-command)

 > You
 > can write macros in object oriented c-like language, not in this 
weird lisp
 > which is a remnant of computing stone age (I know, I know that it is 
still
 > used to teach students).

Good grief.

-- 
Kevin

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

* Re: current directory
  2006-10-23 19:57         ` Eli Zaretskii
@ 2006-10-23 20:36           ` vb
  2006-10-23 21:47             ` Dieter Wilhelm
       [not found]           ` <mailman.178.1161635783.27805.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 28+ messages in thread
From: vb @ 2006-10-23 20:36 UTC (permalink / raw)


On Monday 23 October 2006 12:57, Eli Zaretskii wrote:
> > From: vb <help-gnu-emacs@vsbe.com>
> > Date: Mon, 23 Oct 2006 10:24:36 -0700
> > Cc: don provan <dprovan@comcast.net>
> >
> > All other editors but emacs I am used to
> > maintain a notion of "current directory" and allow the user to change
> > this current directory explicitly. The fact that emacs doesn't even have
> > an infrastructure for that just shows how off mark its approach is.
>
> If I understand you correctly, you think that Emacs doesn't have a way
> of letting you change the current directory.  That is false: the
> command `M-x cd' will do just that.
>

Ok, I stand corrected then, it's good to know there is such a feature, I'll 
make use of it.

Let me ask you about another feature I am missing in emacs and which seems a 
bit more involved to implement myself: maintaining current setup over 
restarts. Say I quit emacs with several files open, each in its own window, 
at certain location in a file. Then I quit the session, do some other editing 
in a different directory tree, and then I come back to start emacs in the 
original directory. It comes up and shows me all those files in all those 
windows exactly the way they were when I quit the original editing session.

Kind of a 'lightweight project management' feature - is it available?

Guys, I really appreciate everybody's comments and replies. Sometimes when 
there is a newcomer bitching about the list topic the tensions get quite high 
- it's good to see that here we can have a dialog even though I am not quite 
completely charmed by emacs :-)

cheers,
/vb

>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: current directory
  2006-10-23 20:32         ` Kevin Rodgers
@ 2006-10-23 20:59           ` vb
  0 siblings, 0 replies; 28+ messages in thread
From: vb @ 2006-10-23 20:59 UTC (permalink / raw)
  Cc: Kevin Rodgers

Kevin,

thank you for the hint on Crisp emulation - I tried it before, and it did not 
work quite as expected - I just tried it again, and it still doesn't - say 
the numeric keypad asterisk which is an 'undo' key in Crisp doesn't work this 
way. Window navigation (Shift->arrow key) doesn't work either, but I am sure 
it all is fixable. A bigger issue is that a big macro library can not be 
reused between Crisp and Emacs (not that I think this is even feasible to 
expect between any two editors).

On Monday 23 October 2006 13:32, Kevin Rodgers wrote:

>
>  > You
>  > can write macros in object oriented c-like language, not in this
>
> weird lisp
>
>  > which is a remnant of computing stone age (I know, I know that it is
>
> still
>
>  > used to teach students).
>
> Good grief.

Yeah, well, I was half kidding. My daughter graduated from UCB CS program 
recently - I watched her learn and use schema - she sure would be quite 
comfortable with Emacs macro extensions.

But believe me, not all (and I would bet not even a majority) of Emacs users 
came through a CS program teaching schema - for all of us it is so weird to 
adjust to Lisp after some most popular in the industry programming languages  
(be it C/C++ or Java or Perl/PHP - whatever people use to earn living these 
days) so many don't even try.

I understand it's too late to expect Emacs to switch to another scripting 
language, but I sure think the need to use lisp  is a deficiency.

cheers,
/vb

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

* Re: current directory
  2006-10-23 20:36           ` vb
@ 2006-10-23 21:47             ` Dieter Wilhelm
  2006-10-24  4:26               ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: Dieter Wilhelm @ 2006-10-23 21:47 UTC (permalink / raw)
  Cc: help-gnu-emacs

vb <help-gnu-emacs@vsbe.com> writes:

> Let me ask you about another feature I am missing in emacs and which seems a 
> bit more involved to implement myself: maintaining current setup over 
> restarts. Say I quit emacs with several files open, each in its own window, 
> at certain location in a file. Then I quit the session, do some other editing 
> in a different directory tree, and then I come back to start emacs in the 
> original directory. It comes up and shows me all those files in all those 
> windows exactly the way they were when I quit the original editing session.
>
> Kind of a 'lightweight project management' feature - is it available?

Yes, of course, please have a look at "Saving Emacs Sessions" in the
GNU Emacs Manual.  But I do not use these features myself.  OK, at
first I was also thinking: Why the heck is there nothing like
"recently opened files" etc. in Emacs.  But after a while I used Emacs
in another more efficient way.  I just never close Emacs and opened
files between reboots.

>
> Guys, I really appreciate everybody's comments and replies. Sometimes when 
> there is a newcomer bitching about the list topic the tensions get quite high 
> - it's good to see that here we can have a dialog even though I am not quite 
> completely charmed by emacs :-)

That is OK, otherwise the list wouldn't have the fun to convert an
unbeliever ;-).

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

* Re: current directory
       [not found]           ` <mailman.178.1161635783.27805.help-gnu-emacs@gnu.org>
@ 2006-10-23 21:52             ` Maarten Bergvelt
  0 siblings, 0 replies; 28+ messages in thread
From: Maarten Bergvelt @ 2006-10-23 21:52 UTC (permalink / raw)


In article <mailman.178.1161635783.27805.help-gnu-emacs@gnu.org>, vb wrote:
> Let me ask you about another feature I am missing in emacs and which seems a 
> bit more involved to implement myself: maintaining current setup over 
> restarts. Say I quit emacs with several files open, each in its own window, 
> at certain location in a file. Then I quit the session, do some other editing 
> in a different directory tree, and then I come back to start emacs in the 
> original directory. It comes up and shows me all those files in all those 
> windows exactly the way they were when I quit the original editing session.
> 
> Kind of a 'lightweight project management' feature - is it available?

http://www.emacswiki.org/cgi-bin/emacs-en?CategoryPersistence

-- 
Maarten Bergvelt		

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

* Re: current directory
  2006-10-23 21:47             ` Dieter Wilhelm
@ 2006-10-24  4:26               ` Eli Zaretskii
  2006-10-24  5:24                 ` Dieter Wilhelm
  0 siblings, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2006-10-24  4:26 UTC (permalink / raw)


> From: Dieter Wilhelm <dieter@duenenhof-wilhelm.de>
> Date: Mon, 23 Oct 2006 23:47:23 +0200
> Cc: help-gnu-emacs@gnu.org
> >
> > Kind of a 'lightweight project management' feature - is it available?
> 
> Yes, of course, please have a look at "Saving Emacs Sessions" in the
> GNU Emacs Manual.

Yes, that's the place to learn about this.

And then there's "M-x recentf-mode RET".

> But I do not use these features myself.

I do.

> OK, at
> first I was also thinking: Why the heck is there nothing like
> "recently opened files" etc. in Emacs.  But after a while I used Emacs
> in another more efficient way.  I just never close Emacs and opened
> files between reboots.

Well, reboots do happen, and I don't want to lose track of my work
when they do.

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

* Re: current directory
  2006-10-24  4:26               ` Eli Zaretskii
@ 2006-10-24  5:24                 ` Dieter Wilhelm
  0 siblings, 0 replies; 28+ messages in thread
From: Dieter Wilhelm @ 2006-10-24  5:24 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Dieter Wilhelm <dieter@duenenhof-wilhelm.de>
>> OK, at
>> first I was also thinking: Why the heck is there nothing like
>> "recently opened files" etc. in Emacs.  But after a while I used Emacs
>> in another more efficient way.  I just never close Emacs and opened
>> files between reboots.
>
> Well, reboots do happen, and I don't want to lose track of my work
> when they do.

Admitted, another scenario I could imagine in this line is when you
want to test the latest CVS Emacs now and then 8-).

Since I'm not a heavy programmer and usually do not have to manage
large file projects, I manage this by loading the usual suspects like
.emacs, .gnus.el, shell buffers, dired buffers, gnus, info, etc. right
at start-up from .emacs.

Thanks for pointing out the direction to go when you are in a
different "nutshell" as I am.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

end of thread, other threads:[~2006-10-24  5:24 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-19  5:16 current directory help-gnu-emacs
2006-10-20  5:49 ` Eli Zaretskii
     [not found] <mailman.74.1161208352.2130.help-gnu-emacs@gnu.org>
2006-10-20 16:46 ` Sam Peterson
     [not found] <mailman.83.1161235004.2130.help-gnu-emacs@gnu.org>
2006-10-19 16:01 ` Fang lun gang
2006-10-19 16:52   ` vb
2006-10-20  6:22     ` Eli Zaretskii
     [not found]   ` <mailman.100.1161276782.2130.help-gnu-emacs@gnu.org>
2006-10-19 19:22     ` rgb
2006-10-19 21:00       ` vb
2006-10-21 18:38     ` don provan
2006-10-23 17:24       ` vb
2006-10-23 19:17         ` John Sullivan
2006-10-23 19:57         ` Eli Zaretskii
2006-10-23 20:36           ` vb
2006-10-23 21:47             ` Dieter Wilhelm
2006-10-24  4:26               ` Eli Zaretskii
2006-10-24  5:24                 ` Dieter Wilhelm
     [not found]           ` <mailman.178.1161635783.27805.help-gnu-emacs@gnu.org>
2006-10-23 21:52             ` Maarten Bergvelt
2006-10-23 20:32         ` Kevin Rodgers
2006-10-23 20:59           ` vb
     [not found]       ` <mailman.166.1161624291.27805.help-gnu-emacs@gnu.org>
2006-10-23 17:48         ` David Kastrup
2006-10-23 20:03           ` Eli Zaretskii
2006-10-23 18:33         ` Colin S. Miller
2006-10-23 18:58           ` vb
     [not found]           ` <mailman.169.1161629903.27805.help-gnu-emacs@gnu.org>
2006-10-23 19:46             ` Peter Boettcher
  -- strict thread matches above, loose matches on Subject: below --
2006-10-18 21:52 help-gnu-emacs
2006-10-18 22:32 ` Peter Dyballa
2006-10-18 23:12   ` vb
2006-10-19  4:25     ` Eli Zaretskii

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.