help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: 24.1.50 + lexical-binding + server.el + server-visit-hook = problem


From: Jim Diamond
Subject: Re: 24.1.50 + lexical-binding + server.el + server-visit-hook = problem
Date: Sun, 24 Jun 2012 17:34:58 -0300
User-agent: slrn/0.9.9p1 (Linux)

On 2012-06-13 at 12:13 ADT, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>>> Ideally, server.el would define a global dynamically-scoped variable
>>>> `server-default-directory' that users could reliably reference to get
>>>> the value of the -dir DIRNAME emacsclient option (instead of defining
>>>> the internal lexically scoped `dir').
>>> It's not quite ideal, tho, because you can have several active
>>> emacsclients at the same time.
>> True, but if you capture the value of the variable into a "safe place"
>> when the hook is called, that's not an issue.
>
> If that safe place is shared by emacsclients, then it won't always work
> (tho it may be sufficient for your particular use case).
>
>> On the other hand, why not have this variable be buffer-local, which
>> would solve the problem of having multiple concurrent emacsclients?
>
> No, making this buffer-local just pushes the problem to "local to
> *which* buffer".  E.g. all emacsclient connections share the same
> internal buffer.
>
>>> A better solution is to store this `dir' into the process's
>>> properties.
>
> Because that's the only real "safe place".
I'll take your word for that.  Putting the directory in a buffer-local
variable worked for me, but putting it in the process avoids the need
for the hook, which is nice.

>> Thanks for your thoughts.  Given the lack of discussion in this
>> thread, I get the idea I'm the only person doing anything like this.
> Maybe, but I'd still accept a patch that makes it easier,

When you say "I'd accept a patch", does that mean you are willing to
put such a thing in, assuming the patch is OK?
If so, how about this diff against the server.el from 24.1:

diff server.el.orig server.el      
1131c1131,1133
<                  (setq dir (command-line-normalize-file-name dir)))
---
>                  (setq dir (command-line-normalize-file-name dir))
>                (process-put proc 'emacsclient-cwd dir)
>                )

In my tests, that does what I want.  I'm not in love with the name
"emacsclient-cwd", so if there is something which is seen as a better
name, that's find with me.

What do you think?

                        Jim


reply via email to

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