From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: directory specific configuration Date: Tue, 21 Jul 2009 17:16:24 +0200 Organization: Anevia SAS Message-ID: <7c3a8qjcc7.fsf@pbourguignon.anevia.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248191863 28555 80.91.229.12 (21 Jul 2009 15:57:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jul 2009 15:57:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 21 17:57:37 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTHii-0007Mf-M3 for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Jul 2009 17:57:36 +0200 Original-Received: from localhost ([127.0.0.1]:45904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTHih-0000hT-Rf for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Jul 2009 11:57:35 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!proxad.net!feeder1-2.proxad.net!212.27.60.64.MISMATCH!cleanfeed3-b.proxad.net!nnrp17-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:yKSJfayt4E7b5hF3uraoDBhwd4I= Original-Lines: 51 Original-NNTP-Posting-Date: 21 Jul 2009 17:16:24 MEST Original-NNTP-Posting-Host: 88.170.236.224 Original-X-Trace: 1248189384 news-2.free.fr 434 88.170.236.224:34013 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:171123 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66313 Archived-At: giampi writes: > Hi all, > short version of the question: is there a way to make emacs read (besides > the local ~/.emacs file) also a directory specific .emacs file, in case that > file exists? > > long version: I use emacs to write latex files. I often use different > languages and therefore would like to use different dictionaries in ispell. > I also often split the document in several tex files, so, every time I have > to set the dictionary manually for each file. Each document is in a > different directory, so it would be practical for me to have an automatic > way to always start emacs with the right dictionary depending on the > directory I run from (or, better, depending on the location of the file I > open). > > I bet this would require just a few lines of lisp in ~/.emacs that do: > 1) get directory of the file I'm opening > 2) check if a .emacs file exists for that directory > 3) source the .emacs file > Unfortunately I'm no lisp programmer, so any help would be appreciated. It would be better to name those files without a prefix dot. It would avoid bad surprises. So assuming that you call those files: config.el you can easily load these files easily: M-x load-file RET ~/some/dir/config.el RET Actually, if you have a latex file open in that directory, then the default directory is already that of the latex file where you have your config.el, so you can just type: M-x load-file RET config.el RET If you only want to change the dictionnary for each latex document, you could do that with File Variables. (info "(emacs)File Variables") Put in a comment at the end of the file: Local Variables: eval: (ispell-change-dictionary "your-specific-dictionary") End: and then when loading again that file, the expression will be evaluated, and you'll be set. -- __Pascal Bourguignon__