From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#15577: 24.3; dir-local variables not applied when switching major-mode Date: Fri, 18 Oct 2013 21:18:39 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1382145559 28872 80.91.229.3 (19 Oct 2013 01:19:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Oct 2013 01:19:19 +0000 (UTC) Cc: 15577 <15577@debbugs.gnu.org> To: yary Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 19 03:19: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 1VXLCK-0004UA-P4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Oct 2013 03:19:20 +0200 Original-Received: from localhost ([::1]:59935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXLCK-0004H4-2q for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Oct 2013 21:19:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXLC9-0004Gd-Fi for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:19:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXLC2-0005Rt-4w for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:19:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXLC2-0005RP-10 for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VXLC1-000882-L6 for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2013 21:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2013 01:19:01 +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.138214553131225 (code B ref 15577); Sat, 19 Oct 2013 01:19:01 +0000 Original-Received: (at 15577) by debbugs.gnu.org; 19 Oct 2013 01:18:51 +0000 Original-Received: from localhost ([127.0.0.1]:57432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXLBq-00087Y-Aj for submit@debbugs.gnu.org; Fri, 18 Oct 2013 21:18:50 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:53547) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXLBn-00087J-1Q for 15577@debbugs.gnu.org; Fri, 18 Oct 2013 21:18:48 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFLd+GD/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFLd+GD/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35853871" Original-Received: from 75-119-225-131.dsl.teksavvy.com (HELO pastel.home) ([75.119.225.131]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 18 Oct 2013 21:18:40 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 7F8BC610B6; Fri, 18 Oct 2013 21:18:39 -0400 (EDT) In-Reply-To: (yary's message of "Fri, 18 Oct 2013 11:43:54 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) 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:79379 Archived-At: > For sub-issue #1 "dir-locals not being applied in the new mode," > divide the responsibility for setting file-locals and dir-locals > between `normal-mode find-file=t' and `define-derived-mode'. Just have > `define-derived-mode' call > `(hack-dir-local-variables)(hack-local-variables-apply)' unless it is > being called as a result of `normal-mode t'. There's no change needed > for the normal-mode function or anything it calls, except perhaps > setting something that the define-derived-mode macro can check. Yes, as mentioned earlier, a possible fix is to move the file-local and dir-local setup code from normal-mode to after-change-major-mode-hook. > a. Get all of that mode's customizable buffer-locals. Not sure what that is. > Ideally the minor-mode, or emacs core, would provide a function for > that purpose. It's probably not possible (not reliably at least) with the way minor modes are defined currently. Tho depending on what you mean it might be a non-issue. > b. Mark those variables as permanent-local There's no such thing, currently (we instead have to use a hack with change-major-mode-hook, along the lines of what you did). For minor-modes, what we could do is to check which buffer-local minor-modes are enabled, and to "simply" re-enable them in after-change-major-mode-hook. But there are some issues: - we have to find out which buffer-local minor-modes are enabled, which presumes we have some kind of list of minor-modes. We can probably use minor-mode-list for that, tho. - some minor modes are mode-specific; e.g. it doesn't make much sense to preserve reftex-mode when switching from latex-mode to haskell-mode. Stefan