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: Mon, 11 Jun 2012 11:33:49 -0300
User-agent: slrn/0.9.9p1 (Linux)

On 2012-06-11 at 10:27 ADT, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
   (>> comments are from Kevin Rodger)
>> 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.

On the other hand, why not have this variable be buffer-local, which
would solve the problem of having multiple concurrent emacsclients?


> A better solution is to store this `dir' into the process's
> properties.

> A related problem is that server-visit-hook is not quite right since
> it's run once-per-file, so if you run "emacsclient FILE1 FILE2 FILE3"
> it's run 3 times, and if you run "emacsclient -t" it's not run at all.
> And server-switch-hook is not any better.
Running the hook 3 times for "emacsclient f1 f2 f3" is not a problem
for me, but your point is good.

> So we'd want a new hook.

> Maybe server-visit-files-function would make sense: its default value
> would be server-visit-files, and you could override it with any other
> function which takes the same arguments (and can call
> server-visit-files internally).  Since server-visit-files receives the
> `proc' as argument, it would have easy access to the process's properties
> (although that would not actually be needed in this case since that
> function is called with default-directory set as needed) and it also
> receives the list of files to visit, which might also come in handy.

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.

                                Jim


reply via email to

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