Skip to main content
added 1 character in body
Source Link
ReneFroger
  • 3.7k
  • 24
  • 67

Configuration:

Emacs 25.0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, then M-x sql-mode.

Paste the following in the buffer:

SELECT SUM(T01.foobar) FROM db_foo.bar T01 WHERE T01.fooID = 1 AND T01.barID = 2 AND T01.foo IS NOT NULL'

SELECT  SUM(T01.foobar)
FROM   db_foo.bar T01
WHERE   T01.fooID = 1
AND    T01.barID = 2
AND  T01.foo IS NOT NULL'

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is indented in an another way:

SELECT  SUM(T01.foobar)
FROM    db_foo.bar T01
WHERE   T01.fooID = 1
    AND T01.barID = 2
    AND T01.foo IS NOT NULL

I would like to change the indentation it in the following:

 SELECT  SUM(T01.foobar)
 FROM    db_foo.bar T01
 WHERE   T01.fooID = 1
 AND     T01.barID = 2
 AND     T01.foo IS NOT NULL

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words and for "AND".

Any suggestion how I could change the indentation of SQL string?

Configuration:

Emacs 25.0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, then M-x sql-mode.

Paste the following in the buffer:

SELECT SUM(T01.foobar) FROM db_foo.bar T01 WHERE T01.fooID = 1 AND T01.barID = 2 AND T01.foo IS NOT NULL'

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is indented in an another way:

SELECT  SUM(T01.foobar)
FROM    db_foo.bar T01
WHERE   T01.fooID = 1
    AND T01.barID = 2
    AND T01.foo IS NOT NULL

I would like to change the indentation it in the following:

 SELECT  SUM(T01.foobar)
 FROM    db_foo.bar T01
 WHERE   T01.fooID = 1
 AND     T01.barID = 2
 AND     T01.foo IS NOT NULL

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words and for "AND".

Any suggestion how I could change the indentation of SQL string?

Configuration:

Emacs 25.0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, then M-x sql-mode.

Paste the following in the buffer:

SELECT  SUM(T01.foobar)
FROM   db_foo.bar T01
WHERE   T01.fooID = 1
AND    T01.barID = 2
AND  T01.foo IS NOT NULL'

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is indented in an another way:

SELECT  SUM(T01.foobar)
FROM    db_foo.bar T01
WHERE   T01.fooID = 1
    AND T01.barID = 2
    AND T01.foo IS NOT NULL

I would like to change the indentation it in the following:

 SELECT  SUM(T01.foobar)
 FROM    db_foo.bar T01
 WHERE   T01.fooID = 1
 AND     T01.barID = 2
 AND     T01.foo IS NOT NULL

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words and for "AND".

Any suggestion how I could change the indentation of SQL string?

added 263 characters in body
Source Link
ReneFroger
  • 3.7k
  • 24
  • 67

Configuration:

Emacs 25.0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, then M-x sql-mode.

Paste the following in the buffer:

SELECT  foo
FROM  bar T01
WHERE  T01.foobar = 1
AND T0.1.barfoo = 2

SELECT SUM(T01.foobar) FROM db_foo.bar T01 WHERE T01.fooID = 1 AND T01.barID = 2 AND T01.foo IS NOT NULL'

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is still misaligned.indented in an another way:

SELECT  SUM(T01.foobar)
FROM    db_foo.bar T01
WHERE   T01.fooID = 1
    AND T01.barID = 2
    AND T01.foo IS NOT NULL

I would like to change the indentation it in the following:

 SELECT  fooSUM(T01.foobar)
 FROM    db_foo.bar T01
 WHERE   T01.foobarfooID = 1
 AND     T01.barfoobarID = 2
 AND     T01.foo IS NOT NULL

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words and for "AND".

Any suggestion how I could change the indentation of SQL string?

Configuration:

Emacs 25.0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, then M-x sql-mode.

Paste the following in the buffer:

SELECT  foo
FROM  bar T01
WHERE  T01.foobar = 1
AND T0.1.barfoo = 2

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is still misaligned.

I would like to change the indentation it in the following:

SELECT  foo
FROM    bar T01
WHERE   T01.foobar = 1
AND     T01.barfoo = 2

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words and for "AND".

Any suggestion how I could change the indentation of SQL string?

Configuration:

Emacs 25.0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, then M-x sql-mode.

Paste the following in the buffer:

SELECT SUM(T01.foobar) FROM db_foo.bar T01 WHERE T01.fooID = 1 AND T01.barID = 2 AND T01.foo IS NOT NULL'

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is indented in an another way:

SELECT  SUM(T01.foobar)
FROM    db_foo.bar T01
WHERE   T01.fooID = 1
    AND T01.barID = 2
    AND T01.foo IS NOT NULL

I would like to change the indentation it in the following:

 SELECT  SUM(T01.foobar)
 FROM    db_foo.bar T01
 WHERE   T01.fooID = 1
 AND     T01.barID = 2
 AND     T01.foo IS NOT NULL

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words and for "AND".

Any suggestion how I could change the indentation of SQL string?

Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Notice added Draw attention by ReneFroger
Bounty Started worth 50 reputation by ReneFroger
deleted 5 characters in body
Source Link
ReneFroger
  • 3.7k
  • 24
  • 67

I use the SQL-modeConfiguration:

Emacs 25. However0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, I have some personal preferences how the indentation should workthen M-x sql-mode. When I indent

Paste the following, in the SQL mode indents it as followingbuffer:

SELECT  foo
FROM    bar T01
WHERE   T01.foobar = 1
AND T01T0.1.barfoo = 2

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is still misaligned.

I would like to change the indentation it in the following:

SELECT  foo
FROM    bar T01
WHERE   T01.foobar = 1
AND     T01.barfoo = 2

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words asand for "AND".

I use the following command for indentation:

(defun indent-buffer ()
  (interactive)
  (save-excursion
     (indent-region (point-min) (point-max) nil))) 

Any suggestion wherehow I could lookchange the indentation of SQL string?

I use the SQL-mode. However, I have some personal preferences how the indentation should work. When I indent the following, the SQL mode indents it as following:

SELECT  foo
FROM    bar T01
WHERE   T01.foobar = 1
AND T01.barfoo = 2

I would like to change the indentation it in the following:

SELECT  foo
FROM    bar T01
WHERE   T01.foobar = 1
AND     T01.barfoo = 2

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words as "AND".

I use the following command for indentation:

(defun indent-buffer ()
  (interactive)
  (save-excursion
     (indent-region (point-min) (point-max) nil))) 

Any suggestion where I could look?

Configuration:

Emacs 25.0.50 on Ubuntu 15.04.

How to produce?

Do emacs -Q, then M-x sql-mode.

Paste the following in the buffer:

SELECT  foo
FROM  bar T01
WHERE  T01.foobar = 1
AND T0.1.barfoo = 2

When I do C-x h, and then M-x indent-region, it says the indent region is done. But the SQL statement is still misaligned.

I would like to change the indentation it in the following:

SELECT  foo
FROM    bar T01
WHERE   T01.foobar = 1
AND     T01.barfoo = 2

So I decided to change the indentation myself. When looking on the source code of SQL mode, I don't see any hints where I could change the indentation for words and for "AND".

Any suggestion how I could change the indentation of SQL string?

added 188 characters in body
Source Link
ReneFroger
  • 3.7k
  • 24
  • 67
Loading
Source Link
ReneFroger
  • 3.7k
  • 24
  • 67
Loading