From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: yary Newsgroups: gmane.emacs.bugs Subject: bug#15577: 24.3; dir-local variables not applied when switching major-mode Date: Mon, 14 Oct 2013 14:41:34 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1381776199 29246 80.91.229.3 (14 Oct 2013 18:43:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Oct 2013 18:43:19 +0000 (UTC) Cc: 15577 <15577@debbugs.gnu.org> To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 14 20:43:22 2013 Return-path: Envelope-to: geb-bug-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 1VVn6s-0000ll-Gr for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Oct 2013 20:43:18 +0200 Original-Received: from localhost ([::1]:38329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVn6s-0006Qy-2T for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Oct 2013 14:43:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVn6j-0006QZ-3h for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 14:43:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVn6d-0003EC-37 for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 14:43:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVn6c-0003E2-Vv for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 14:43:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VVn6c-0005nc-EF for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 14:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: yary Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Oct 2013 18:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15577 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15577-submit@debbugs.gnu.org id=B15577.138177612521858 (code B ref 15577); Mon, 14 Oct 2013 18:43:02 +0000 Original-Received: (at 15577) by debbugs.gnu.org; 14 Oct 2013 18:42:05 +0000 Original-Received: from localhost ([127.0.0.1]:49259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVn5f-0005gP-Su for submit@debbugs.gnu.org; Mon, 14 Oct 2013 14:42:04 -0400 Original-Received: from mail-we0-f179.google.com ([74.125.82.179]:61789) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVn5c-0005eg-Tu for 15577@debbugs.gnu.org; Mon, 14 Oct 2013 14:42:01 -0400 Original-Received: by mail-we0-f179.google.com with SMTP id w61so7581898wes.10 for <15577@debbugs.gnu.org>; Mon, 14 Oct 2013 11:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=7Wuvimydphhz8innCv3s1BaWG+tgtxP/B7mXqyHJAAs=; b=n97cmFYQzp3Pkw5m82EEOPm7JRVKHrUJewriLnJGZ02THTZOhamjpGc7ZybAxk30uc k4gGJ2bZ601SS9oicr/DK53r0WggribnmvgKVWAKvnGO7c3C8XX3LeYqd+OJzTp5Ksge SkyUPCPz0fz+qV8Gzo4kv+q/yVScQOecPKlQjYTopT60sQU4GJ90N7g9Vw6KVp6Zj61M a5GnHf0GGzERnJC9OgFkGMQkuIvtlvg9G4qsY/uvLEGTspkEplprW9YVHOSwIy4R2Dqy fjNzwDFONkTQuVU/2sWkBB1Rd4k7Tad9p3i3gehDNLzV/GADXFSYnljdDR79gA3S8Srf 8YyA== X-Received: by 10.194.110.138 with SMTP id ia10mr31271942wjb.3.1381776115007; Mon, 14 Oct 2013 11:41:55 -0700 (PDT) Original-Received: by 10.194.83.72 with HTTP; Mon, 14 Oct 2013 11:41:34 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79244 Archived-At: Thinking about switching major modes more, my instinct is that the right solution involves being "smarter" both about which local variables to clear and reloading any {dir,file}-local variables for the new node. Basically, at the start, instead of calling "kill-all-local-variables", only clear the locals that were set as a consequence of the old mode. That is, if it was set directly by the old mode, or by dir-local matching the old mode, delete it. Don't delete a buffer-local variable if it was set explicitly by the user after opening during the editing session. Then after the new mode has set itself, recheck dir-locals and set any that match the new mode. Alas I don't use file-locals so am not sure how their use cases fit. Ignore any "mode:" specifiers and maybe "eval:" as well after the mode-change, I'd guess.