emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax based indentation for SQL files (ELPA package proposal)


From: Michael Mauger
Subject: Re: syntax based indentation for SQL files (ELPA package proposal)
Date: Sun, 16 Sep 2018 01:11:11 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, 11 September 2018 08:16, Stefan Monnier <address@hidden> 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 minor
> > > 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 to
> > 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.

--
address@hidden // FSF and EFF member // GNU Emacs sql.el maintainer





reply via email to

[Prev in Thread] Current Thread [Next in Thread]