From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: 24.1.50 + lexical-binding + server.el + server-visit-hook = problem Date: Mon, 11 Jun 2012 09:27:32 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1339421416 23411 80.91.229.3 (11 Jun 2012 13:30:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2012 13:30:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 11 15:30:15 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Se4hB-00045Y-K6 for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Jun 2012 15:30:13 +0200 Original-Received: from localhost ([::1]:41268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se4hB-0001Bu-8f for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Jun 2012 09:30:13 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe16.iad.POSTED!00000000!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) Cancel-Lock: sha1:wEewGgn6izfQlDv9bVtvkjX63Q0= Original-Lines: 35 Original-X-Complaints-To: abuse@UsenetServer.com Original-NNTP-Posting-Date: Mon, 11 Jun 2012 13:27:32 UTC X-Received-Bytes: 2370 Original-Xref: usenet.stanford.edu gnu.emacs.help:192802 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85205 Archived-At: > 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