From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Add a separate mode for .dir-locals.el Date: Thu, 17 Oct 2019 12:37:56 -0400 Message-ID: References: <2058328b-aee5-8cb1-2659-a793e1354517@mit.edu> <87wod4m7sr.fsf@gnus.org> <835zkndcz4.fsf@gnu.org> <83ftjrbjhm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="101417"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii , =?windows-1252?Q?Cl=E9ment?= Pit-Claudel , emacs-devel To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 17 19:07:33 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iL9FM-000Q9X-FV for ged-emacs-devel@m.gmane.org; Thu, 17 Oct 2019 19:07:33 +0200 Original-Received: from localhost ([::1]:53736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL9FK-00006P-Uh for ged-emacs-devel@m.gmane.org; Thu, 17 Oct 2019 13:07:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40317) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL8mq-0005b6-Ho for emacs-devel@gnu.org; Thu, 17 Oct 2019 12:38:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL8mp-00035y-7Q for emacs-devel@gnu.org; Thu, 17 Oct 2019 12:38:04 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:6772) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iL8mm-00034X-Sc; Thu, 17 Oct 2019 12:38:01 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 262A54490BA; Thu, 17 Oct 2019 12:38:00 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C55FB4490BC; Thu, 17 Oct 2019 12:37:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1571330278; bh=q31MGOqOE2hwcjN2Bsl97DXXRKgNy7MbdF+kUuJ5yH8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=gQniwb+ihPWTOUZdqwy8GkjgI2Ipd+0yI2ZhJOVGNt3RP5MyjUyVcep0ankghdi2n dL5wu9djInrVS7kMSolfiq6ZgNCngFekioZIMpCe8oKIXHN3beFmioDT9ou6rq92EE 46zBiKuCjHwsTVCBh6hdhuFCMJugXPOH7kR7EnGE89D5WoUAbqswmCvqhymj7SnCw4 Y7YMG+BXQ9yqtdweOCJN0H+cj5MTkD7Ndxqex9gV1GRW0upKhBG+uWrsiNQ6tdkThe uZ3V6CJ3ZldmJxUeN5D9i6L4D+aqtqVAQ8ja0xIXVhatReuktDVY5FnbLq977nQB4R 6o1sZRU5HRYMw== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8BEBB1209C7; Thu, 17 Oct 2019 12:37:58 -0400 (EDT) In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1v?= =?windows-1252?Q?ora=22's?= message of "Thu, 17 Oct 2019 16:41:00 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241153 Archived-At: >>> A better option would be to have a base `lisp-prog-mode` and hen >>> derive emacs-lisp-mode from it. >> Exactly. dir-locals-mode should share a parent with emacs-lisp-mode. > Yes. Is this very hard to do? No, it should be straightforward. Se sample patch below. Stefan =20=20=20=20=20=20=20=20 diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 516e4f9cd63..da275bcae60 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -231,8 +231,16 @@ emacs-lisp-set-electric-text-pairs (setq-local electric-pair-text-pairs elisp-pairs))))) (remove-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pai= rs)) =20 + +(define-derived-mode emacs-lisp-data-mode prog-mode "Emacs-Lisp-Data" + "Major mode for buffers holding data written in Emacs Lisp syntax." + :group 'lisp + (lisp-mode-variables nil nil 'elisp) + (setq-local electric-quote-string t) + (setq imenu-case-fold-search nil)) + ;;;###autoload -(define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" +(define-derived-mode emacs-lisp-mode emacs-lisp-data-mode "Emacs-Lisp" "Major mode for editing Lisp code to run in Emacs. Commands: Delete converts tabs to spaces as it moves back. @@ -241,15 +249,12 @@ emacs-lisp-mode \\{emacs-lisp-mode-map}" :group 'lisp (defvar project-vc-external-roots-function) - (lisp-mode-variables nil nil 'elisp) (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers) (if (boundp 'electric-pair-text-pairs) (setq-local electric-pair-text-pairs (append '((?\` . ?\') (?=E2=80=98 . ?=E2=80=99)) electric-pair-text-pairs)) (add-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pair= s)) - (setq-local electric-quote-string t) - (setq imenu-case-fold-search nil) (add-function :before-until (local 'eldoc-documentation-function) #'elisp-eldoc-documentation-function) (add-hook 'xref-backend-functions #'elisp--xref-backend nil t)