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

On 2012-06-07 at 00:42 ADT, Kevin Rodgers <kevin.d.rodgers@gmail.com> wrote:
> On 6/6/12 2:01 PM, Jim Diamond wrote:

>> (require 'server)
>> (defvar emacsclient-dir-for-this-buffer nil
>>      "Name of the directory emacsclient was called from for this buffer.")
>> (make-variable-buffer-local 'emacsclient-dir-for-this-buffer)
>> (defun saveconf-server-save-emacsclient-dir ()
>>      "Save the directory from which emacsclient was called.
>>      This is called from a place in server.el (server-visit-files)
>>      where the variable 'dir' is equal to the directory emacsclient
>>      was called from."
>>      (setq emacsclient-dir-for-this-buffer dir)
>> )
>> (add-hook 'server-visit-hook 'saveconf-server-save-emacsclient-dir)

>> And, if so, do you have a suggestion on the right way to get this
>> information I want?

> 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').
That sounds good to me.

> But until then,
Do you think that is likely to happen?

> I think you could fake it by calling emacsclient from a shell with
> -eval "(setq server-default-directory \"$PWD\")"
Well, after a bit of fussing around, I do have a solution that works
with that idea, thanks very much.  It is unfortunate (at least in this
case) that emacsclient does not let you visit files (in the "usual"
way) if you use --eval.

Thanks for your help.

                                Jim


reply via email to

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