From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.devel Subject: Re: syntax based indentation for SQL files (ELPA package proposal) Date: Sun, 16 Sep 2018 01:11:11 +0000 Message-ID: References: <808t48ny4y.fsf@gmail.com> Reply-To: Michael Mauger NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1537060172 18990 195.159.176.226 (16 Sep 2018 01:09:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Sep 2018 01:09:32 +0000 (UTC) Cc: Michael Mauger , Alex Harsanyi , "pierre.techoueyres@free.fr" , "simenheg@gmail.com" , "emacs-devel@gnu.org" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 16 03:09:27 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1LYz-0004q7-Of for ged-emacs-devel@m.gmane.org; Sun, 16 Sep 2018 03:09:26 +0200 Original-Received: from localhost ([::1]:57315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1Lb6-0000lE-9K for ged-emacs-devel@m.gmane.org; Sat, 15 Sep 2018 21:11:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1Lau-0000l4-Mh for emacs-devel@gnu.org; Sat, 15 Sep 2018 21:11:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1Lar-0002sf-Hz for emacs-devel@gnu.org; Sat, 15 Sep 2018 21:11:24 -0400 Original-Received: from mail2.protonmail.ch ([185.70.40.22]:33003) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1Lar-0002h9-3L for emacs-devel@gnu.org; Sat, 15 Sep 2018 21:11:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1537060273; bh=8tz5RrSNxtud2htKO5dFrjQoJccUGOvYcSIo2ndrN/o=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=bYIIdeE44dTFKY10U6eH0mTPQFgFApPUGhF8Nowgw4XPib9MiGxuK/NYIIadWKU9Q cTaZutmZF1ueLImcqoA9lHDr0GQFe43ddI9FdnqG9XJDdGhUCy6q0uAXWKjl6g4iMD YQa8UamA6HeXZrOXCfBJ0pslYC/FHqNXjcaBpuRo= In-Reply-To: Feedback-ID: b6CpL0MxcIA6fpHRkn3ZHzWS0Hoqxbtv_SrHfEzC9D85cLvnRsVk4rKaAOJUw48iy20W0W1VX4whjBYFluIX0w==:Ext:ProtonMail X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.70.40.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:229834 Archived-At: =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Tuesday, 11 September 2018 08:16, Stefan Monnier wrote: > >> I believe the default behavior should be to enable automatic > > > indentation. We can provide some way for the user to disable it, of > > > course (actually, I think it would make sense to offer a generic mino= r > > > mode which provides "dumb" indentation in any major mode). > > > I'm happy to see that sql-indent was added to ELPA last year, but I > > > agree with Stefan that it would be even better if SQL mode offered > > > automatic indentation by default, like major modes usually do. > > > > I could make an attempt to integrate it with SQL mode, with an option t= o > > turn it off, if there is interest for it? > > The main prerequisite for that would be to move sql-indent from elpa.git > to emacs.git. I think it's a good idea to bring sql.el and > sql-indent.el closer to each other (an alternative would be to move > sql.el to elpa.git, but that's probably not gonna fly), but it's rather > a question for Alex, Michael, and Emacs's maintainers. > > Stefan Apologize for the delay... My thought was that we can add default support with the two modules in different repositories (although I have no concern about either proposal made by Stefan: sql, sql-indent both to emacs.git or to elpa.git). Below is an initial attempt to perform the integration that could be added to sql.el. In addition, the initial values of `sql-mode-hook= ' and `sql-interactive-mode-hook' would be set to '(sql-indent-enable). Code (un-tested):: ;; SQL indent support (defcustom sql-use-indent-support t "If non-nil then use the SQL indent support features of sql-indent. The package must be available to be loaded and activated.") (defun sql-is-indent-available () "Check if sql-indent module is available." (when (locate-library "sql-indent") (require 'sql-indent) (fboundp 'sqlind-minor-mode))) (defun sql-indent-enable () "Enable `sqlind-minor-mode' if available and requested." (when (sql-is-indent-available) (sqlind-minor-mode (if sql-use-indent-support +1 -1)))) I'd also recommend we add a large comment block to sql.el recommending the installation of sql-indent if not installed by default. -- MICHAEL@MAUGER.COM // FSF and EFF member // GNU Emacs sql.el maintainer