unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: .dir-locals.el
Date: Wed, 07 Jan 2009 21:53:49 -0800	[thread overview]
Message-ID: <87sknuwdg2.fsf@gmail.com> (raw)
In-Reply-To: gk3qem$4b0$1@ger.gmane.org

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> Eric Schulte wrote:
>> Is there a good way to apply the variables set in .dir-locals.el when
>> changing into and out of a directory in eshell (or I suppose in other
>> Emacs shells as well)?
>>
>> I've tried setting eshell as a mode in the .dir-locals.el file but with
>> no success.  I've also tried to define after-advice on the `cd' function
>> in eshell, but there doesn't appear to be any means for applying local
>> variables to a buffer which doesn't have a file-name.
>>
>> (defadvice cd (after dir-locals-on-cd activate)
>>   "Apply the variables defined in .dir-locals.el when changing
>> into and outof a directory in eshell."
>>   (hack-dir-local-variables))
[...]
> I don't know.  But you should be able to get your advice to work by
> let-binding buffer-file-name to default-directory around the call to
> hack-dir-local-variables.
>
> Or perhaps to (expand-file-name "foo").

Thanks for the suggestion, by replacing (buffer-file-name) in
hack-dir-local-variables with default-directory I was able to save the
values specified in .dir-locals.el to the `file-local-variables-alist'.
Unfortunately it looks as though the values of the
`file-local-variables-alist' are only applied when the current buffer is
visiting a file.  Namely the resulting occurs in eshell

  ~ $ (message (format "%S" foo-foo-foo))
  nil
  ~ $ (message (format "%S" file-local-variables-alist))
  nil
  ~ $ cd src/mep/
  ~/src/mep $ cat .dir-locals.el 
  ((nil . ((foo-foo-foo . "eschulte"))))
  ~/src/mep $ (message (format "%S" file-local-variables-alist))
  ((foo-foo-foo . "eschulte"))
  ~/src/mep $ (message (format "%S" foo-foo-foo))
  nil
  ~/src/mep $ 

Either I'm missing something (more than likely) or given the current
implementation it does not make sense to try to use .dir-locals.el for
setting variables inside of an eshell buffer.

Best -- Eric




  reply	other threads:[~2009-01-08  5:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-26 15:18 .dir-locals.el Eli Zaretskii
2008-12-26 16:04 ` .dir-locals.el Eli Zaretskii
2008-12-27  2:39   ` .dir-locals.el Miles Bader
2008-12-27  9:33     ` .dir-locals.el Eli Zaretskii
2008-12-27 16:43       ` .dir-locals.el Juanma Barranquero
2008-12-27 17:13 ` .dir-locals.el Dan Nicolaescu
2008-12-27 19:04   ` .dir-locals.el Eli Zaretskii
2009-01-08  0:08     ` .dir-locals.el Eric Schulte
2009-01-08  3:04       ` .dir-locals.el Kevin Rodgers
2009-01-08  5:53         ` Eric Schulte [this message]
2009-01-08 16:30       ` .dir-locals.el Stefan Monnier
2009-01-08 22:45         ` .dir-locals.el Juri Linkov
2009-01-09  3:14           ` .dir-locals.el Stefan Monnier
2009-01-09  0:30         ` .dir-locals.el Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sknuwdg2.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).