all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* smart indentation for SQL files
@ 2015-12-21 11:42 Alex Harsanyi
  2015-12-22  5:39 ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Harsanyi @ 2015-12-21 11:42 UTC (permalink / raw)
  To: emacs-devel

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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: smart indentation for SQL files
  2015-12-21 11:42 Alex Harsanyi
@ 2015-12-22  5:39 ` John Wiegley
  2015-12-23 12:27   ` Alex Harsanyi
  0 siblings, 1 reply; 8+ messages in thread
From: John Wiegley @ 2015-12-22  5:39 UTC (permalink / raw)
  To: Alex Harsanyi; +Cc: emacs-devel

>>>>> Alex Harsanyi <alexharsanyi@gmail.com> writes:

> 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.

Hi Alex,

In the interests of expedience, would you mind starting out this module under
the name "sql-indent.el", and committing it to ELPA? It will not make it into
25.1 in any case, since no more features are being accepted there. But within
ELPA, users may still find it after installation.

Once your code is ready there, we can talk later about integrating it directly
into sql.el, or making it more accessible some other way (such as tarball ELPA
with a suitable autoload).

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: smart indentation for SQL files
  2015-12-22  5:39 ` John Wiegley
@ 2015-12-23 12:27   ` Alex Harsanyi
  2015-12-23 17:35     ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Harsanyi @ 2015-12-23 12:27 UTC (permalink / raw)
  To: Alex Harsanyi, emacs-devel

Hi John,

I updated the file with package headers, so `package-install-file' can
install it (there is only one file for the package). However, I don't
have permissions to push it to ELPA, so I cannot add it there.  If
you, or someone else would like to add it to ELPA, you can find the
package at:

https://github.com/alex-hhh/emacs-sql-indent/blob/master/sql-indent.el

Best Regards,
Alex.

2015-12-22 13:39 GMT+08:00 John Wiegley <jwiegley@gmail.com>:
>>>>>> Alex Harsanyi <alexharsanyi@gmail.com> writes:
>
>> 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.
>
> Hi Alex,
>
> In the interests of expedience, would you mind starting out this module under
> the name "sql-indent.el", and committing it to ELPA? It will not make it into
> 25.1 in any case, since no more features are being accepted there. But within
> ELPA, users may still find it after installation.
>
> Once your code is ready there, we can talk later about integrating it directly
> into sql.el, or making it more accessible some other way (such as tarball ELPA
> with a suitable autoload).
>
> --
> John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: smart indentation for SQL files
  2015-12-23 12:27   ` Alex Harsanyi
@ 2015-12-23 17:35     ` John Wiegley
  0 siblings, 0 replies; 8+ messages in thread
From: John Wiegley @ 2015-12-23 17:35 UTC (permalink / raw)
  To: Alex Harsanyi; +Cc: emacs-devel

>>>>> Alex Harsanyi <alexharsanyi@gmail.com> writes:

> I updated the file with package headers, so `package-install-file' can
> install it (there is only one file for the package). However, I don't have
> permissions to push it to ELPA, so I cannot add it there. If you, or someone
> else would like to add it to ELPA, you can find the package at:

> https://github.com/alex-hhh/emacs-sql-indent/blob/master/sql-indent.el

Thank you, I will see that this is done. Getting full access to ELPA is
something I'm still working on with the folks at GNU this week.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 8+ messages in thread

* smart indentation for SQL files
@ 2017-05-03  9:12 Alex Harsanyi
  2017-05-03 21:32 ` Stefan Monnier
  2017-05-04  0:55 ` Clément Pit-Claudel
  0 siblings, 2 replies; 8+ messages in thread
From: Alex Harsanyi @ 2017-05-03  9:12 UTC (permalink / raw)
  To: emacs-devel

Hello,

A while ago, I posted on this mailing list about a SQL indentation
package that I wrote.  The package provides indentation for SQL files,
similar to how cc-mode works, it even allows customizing the
indentation rules.  The current sql.el mode only provides syntax
highlighting.

You can find the package here:

    https://github.com/alex-hhh/emacs-sql-indent

and the previous discussion here:

    https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00943.html

Could this package be considered for inclusion in sql.el or as an ELPA package?

I have already signed papers for contributing to Emacs.

Best Regards,
Alex.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: smart indentation for SQL files
  2017-05-03  9:12 smart indentation for SQL files Alex Harsanyi
@ 2017-05-03 21:32 ` Stefan Monnier
  2017-05-04 10:15   ` Alex Harsanyi
  2017-05-04  0:55 ` Clément Pit-Claudel
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2017-05-03 21:32 UTC (permalink / raw)
  To: emacs-devel

> Could this package be considered for inclusion in sql.el or as an
> ELPA package?

I think it would make a lot of sense to include it into sql.el, but if
that's not an option, I'll happily add it to GNU ELPA.


        Stefan


PS: BTW, in sqlind-indent-line I recommend you use indent-line-to.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: smart indentation for SQL files
  2017-05-03  9:12 smart indentation for SQL files Alex Harsanyi
  2017-05-03 21:32 ` Stefan Monnier
@ 2017-05-04  0:55 ` Clément Pit-Claudel
  1 sibling, 0 replies; 8+ messages in thread
From: Clément Pit-Claudel @ 2017-05-04  0:55 UTC (permalink / raw)
  To: emacs-devel

On 2017-05-03 05:12, Alex Harsanyi wrote:
> Could this package be considered for inclusion in sql.el 

Yes please! That would be great.

> or as an ELPA package?

If direct inclusion works, it would be much better, I think.

Clément.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: smart indentation for SQL files
  2017-05-03 21:32 ` Stefan Monnier
@ 2017-05-04 10:15   ` Alex Harsanyi
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Harsanyi @ 2017-05-04 10:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

2017-05-04 5:32 GMT+08:00 Stefan Monnier <monnier@iro.umontreal.ca>:
>> Could this package be considered for inclusion in sql.el or as an
>> ELPA package?
>
> I think it would make a lot of sense to include it into sql.el, but if
> that's not an option, I'll happily add it to GNU ELPA.

I also think it fits better with sql.el, but this is a decision for
the Emacs maintainers.   I am, of course, happy to provide support and
fix any bugs in this code regardless of how it is added.

>
>
>         Stefan
>
>
> PS: BTW, in sqlind-indent-line I recommend you use indent-line-to.

I updated the code to use `indent-line-to`, I was not aware of that function...

Is there anything else I need to do to progress this?

Thanks,
Alex.

>
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-04 10:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-03  9:12 smart indentation for SQL files Alex Harsanyi
2017-05-03 21:32 ` Stefan Monnier
2017-05-04 10:15   ` Alex Harsanyi
2017-05-04  0:55 ` Clément Pit-Claudel
  -- strict thread matches above, loose matches on Subject: below --
2015-12-21 11:42 Alex Harsanyi
2015-12-22  5:39 ` John Wiegley
2015-12-23 12:27   ` Alex Harsanyi
2015-12-23 17:35     ` John Wiegley

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.