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: Wed, 16 Oct 2013 10:26:14 -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 1381933636 13054 80.91.229.3 (16 Oct 2013 14:27:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Oct 2013 14:27:16 +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 Wed Oct 16 16:27:19 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 1VWS4E-0005jW-Ub for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Oct 2013 16:27:19 +0200 Original-Received: from localhost ([::1]:47517 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWS4E-0003Vp-Gm for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Oct 2013 10:27:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWS46-0003VX-8d for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2013 10:27:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWS3y-0005EQ-Ls for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2013 10:27:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWS3y-0005EM-J1 for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2013 10:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VWS3y-0003kE-7M for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2013 10:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: yary Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Oct 2013 14:27: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.138193360414369 (code B ref 15577); Wed, 16 Oct 2013 14:27:02 +0000 Original-Received: (at 15577) by debbugs.gnu.org; 16 Oct 2013 14:26:44 +0000 Original-Received: from localhost ([127.0.0.1]:54338 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VWS3f-0003jg-Bo for submit@debbugs.gnu.org; Wed, 16 Oct 2013 10:26:43 -0400 Original-Received: from mail-wi0-f171.google.com ([209.85.212.171]:57187) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VWS3d-0003jS-85 for 15577@debbugs.gnu.org; Wed, 16 Oct 2013 10:26:41 -0400 Original-Received: by mail-wi0-f171.google.com with SMTP id h11so2473606wiv.16 for <15577@debbugs.gnu.org>; Wed, 16 Oct 2013 07:26:35 -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=Z4TYfI5k3xL/lz6bM5F9YkxHjfRzV8ouvYMYaGyvcdw=; b=BPd8dz7IFmXr30SapLdpBfeieE2oXWPNfniC0Z2k7BFbXgjJAOQnKKeoXeTI6yPP0H /AoHcfSrnBL/QsoDnqbZ3oKcjFSbF7VCZWDAPcg48Ty+wHXmfm+YiswiJzJXgJZu7HFc NIfhk1VuDIw+p+vdYPwMZV9xxDamGPAiEfEN87VdIxyhaKbla9qkIgd6higw5FV+whIz 6la5qYdhao0F/zWWWXOMnZVql6gt2eegIYP1s2gs+bUnOARC4I/vLAaFyWm4Z9zlvopr z8eddKJG6eW+s+3v0kCx6paDo284AZZ0uu8HeK/ag1OWDbgw7y1K7yvKBVQrMySdjX7C vDnQ== X-Received: by 10.180.99.99 with SMTP id ep3mr2565532wib.11.1381933595277; Wed, 16 Oct 2013 07:26:35 -0700 (PDT) Original-Received: by 10.194.83.72 with HTTP; Wed, 16 Oct 2013 07:26:14 -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:79310 Archived-At: More thoughts, overturning my previous message of Oct 14th. I think I have the essence of the issues now. In my editing, I switch modes within a buffer (file) when working on: A. databases- SQL inside code, or non-SQL language inside SQL triggers B. web- HTML, CSS, JS is just the beginning... C. any language with heredocs (shell, python, perl)- sometimes have unrelated language blocks inside parent/wrapper code and I've had these undesirable local-variable issues caused by that mode switching: 1. dir-locals not being applied in the new mode 2. "manually" set local variables and minor-modes being lost. Issue #1 "dir locals" is a narrow use case. Dir locals are not intended to set a major mode; they are meant to set buffer-locals after the major mode is in place. Whether set by a .dir-locals,el file or dir-locals-set-* functions, the user is saying "buffers from files here in this mode should have those variables set" and is saying so clearly. So, to fix that issue, after switching major modes, it would be good to run "hack-dir-local-variables-non-file-buffer" to pick up any dir-locals for the new mode. Properly implementing that as an Emacs bug-fix is out of my skillset, though the tips from stackoverflow helped me put a workaround in my ~/.emacs Issue #2- "manually" set buffer-local's, and by extension file-local variables- is trickier. Trying to automate what happens there smells of unintended consequences. The answer here is an easier way for us to set the "permanent-local-hook" property for variables (eg "tab-width"), and minor-modes (eg "buffer-face-mode" with its new face). Then I & others who use file-locals can mark a particular item as "permanent" right in the file. Additionally, for other local variables that people might want to keep (eg set interactively), have an interactive command to mark a buffer-local variable or minor-mode as permanent. And also, allow describe-variable, describe-minor-mode to show/set the "permanent-local-hook" property.