From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Harsanyi Newsgroups: gmane.emacs.devel Subject: smart indentation for SQL files Date: Mon, 21 Dec 2015 19:42:18 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1450698163 29836 80.91.229.3 (21 Dec 2015 11:42:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Dec 2015 11:42:43 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 21 12:42:42 2015 Return-path: Envelope-to: ged-emacs-devel@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 1aAyrS-0000ZF-Gw for ged-emacs-devel@m.gmane.org; Mon, 21 Dec 2015 12:42:42 +0100 Original-Received: from localhost ([::1]:44292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAyrR-0007C7-SF for ged-emacs-devel@m.gmane.org; Mon, 21 Dec 2015 06:42:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAyr6-0006zC-9B for emacs-devel@gnu.org; Mon, 21 Dec 2015 06:42:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aAyr5-0006Rk-BF for emacs-devel@gnu.org; Mon, 21 Dec 2015 06:42:20 -0500 Original-Received: from mail-io0-x230.google.com ([2607:f8b0:4001:c06::230]:33938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAyr5-0006Rf-6p for emacs-devel@gnu.org; Mon, 21 Dec 2015 06:42:19 -0500 Original-Received: by mail-io0-x230.google.com with SMTP id e126so151596900ioa.1 for ; Mon, 21 Dec 2015 03:42:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=DGGHUpTffUPpizk8An2+svGgDNWnMWeMJmLeFVY2NOw=; b=sGiDb8JpY86TpUGhIdiiB/H+R6P8e1U2Qx+t2b1kLRuOQqqMp5mzUy2m1VFsSh8unz u9ru+iosSKEgc0JXwHPp0K3mfh0gfRekZGJ4qPl0NeMVlfihAbiqTC3PhRYcpw71YYca hH+n1msdvCuG9gWkJLVgEu1jbqFHDGSaWYsZRwFWxMWWw3G8x9VU6c9Y4AnONISzq5kK rQXMfaWSB1Z5DGGlDSo611qH9dkO/S4mzIunxtDqFhSDXH+fv+6rAlAQNDZUu3MzfdSx huosMTVqXhV0IkGb9r2OupYCxA3dgt4vzt14rISRp88XqH+aGnSvaQYdjQBa7ac0jKz7 Z8DQ== X-Received: by 10.107.131.207 with SMTP id n76mr17451363ioi.135.1450698138549; Mon, 21 Dec 2015 03:42:18 -0800 (PST) Original-Received: by 10.107.130.228 with HTTP; Mon, 21 Dec 2015 03:42:18 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196600 Archived-At: Hello, About 10 years ago I had to edit many SQL files and the sql-mode that shipped with GNU Emacs did not provide any smart indentation. At the time, I wrote a small indentation package, which I used for several months but never released publicly. Shortly after, I changed jobs and didn't have to look at SQL files again until recently. I noticed that the SQL indentation support is still missing from Emacs and to my surprise my old code worked just fine. I cleaned up the old code a bit, added suport for indenting WITH statements and uploaded it to Github at: https://github.com/alex-hhh/emacs-sql-indent The code is similar to cc-mode, in that it separates the "parsing" of the SQL code from the indentation and the indentation rules can be modified by the user to conform to local indentaiton guidelines or preferences. I think this code would be a nice addition to sql.el. Best Regards, Alex.