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: Stefan Monnier
Subject: Re: 24.1.50 + lexical-binding + server.el + server-visit-hook = problem
Date: Mon, 11 Jun 2012 09:27:32 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

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

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.

> a shell with -eval "(setq server-default-directory \"$PWD\")"

You don't need to rely on $PWD, you can use

   -eval "(setq server-default-directory default-directory)"

but indeed, it's not very convenient.


        Stefan


reply via email to

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