From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joakim Hove Newsgroups: gmane.emacs.help Subject: Re: language environment depending on file Date: Fri, 15 Oct 2004 11:47:39 +0200 Organization: University of Bergen Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1097833688 23650 80.91.229.6 (15 Oct 2004 09:48:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Oct 2004 09:48:08 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 15 11:48:01 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CIOgr-0006EW-00 for ; Fri, 15 Oct 2004 11:48:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CIOnz-0001IW-VQ for geh-help-gnu-emacs@m.gmane.org; Fri, 15 Oct 2004 05:55:24 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!news.tele.dk!news.tele.dk!small.news.tele.dk!uninett.no!nntp.uib.no!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 64 Original-NNTP-Posting-Host: termo1.fi.uib.no Original-X-Trace: toralf.uib.no 1097833662 80234 129.177.39.206 (15 Oct 2004 09:47:42 GMT) Original-X-Complaints-To: abuse@uib.no Original-NNTP-Posting-Date: 15 Oct 2004 09:47:42 GMT User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:lzQwCNrCls66i/nETFswNO5mOAA= Original-Xref: shelby.stanford.edu gnu.emacs.help:125884 Original-To: help-gnu-emacs@gnu.org 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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21254 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21254 slanning@theworld.com writes: > > (add-hook 'mmm-mode-hook > '(lambda () > (make-variable-buffer-local 'current-language-environment) > (set-language-environment "UTF-8"))) /----[C-h v current-language-environmen] | current-language-environment's value is "Latin-1" | | Documentation: | The last language environment specified with `set-language-environment'. | This variable should be set only with M-x customize, which is equivalent | to using the function `set-language-environment'. | | You can customize this variable. | | Defined in `international/mule-cmds'. \---- The way I read the above documentation, you really can not set a value to the current-language-environment variable, the only way to change the language environment is through the (set-language-environment ) function, and then you can *read* the language-env. status by checking the current-lang.-env. variable. > I guess I could add a similar hook as above for every other mode, > setting language environment back to what I want for the default, > but that seems pretty ugly. Yes ugly, and I think it is even worse, because you would have to change lang.-env. every time you changed buffer (I think). [I dare not think of the situation when multiple windows/frames are active at the same time.] Anyway, you *might* try to advice the set-buffer or switch-to-buffer functions with something like: (defun set-lang-env () (if (eq major-mode 'mmm-mode) (unless (string-equal current-language-environment "UTF-8") (set-language-environment "UTF-8")) (if (string-equal current-language-environment "UTF-8") (set-language-environment "Latin-1")))) (defadvice set-buffer (before lang-env-advice (arg)) "Set language env. when going to a new buffer" (set-lang-env)) (ad-activate 'lang-env-advice) Good luck - Joakim -- Joakim Hove hove AT ift uib no +47 (55 5)8 27 90 http://www.ift.uib.no/~hove/