help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: indenting SQL in php_mode


From: Ian Eure
Subject: Re: indenting SQL in php_mode
Date: Sun, 7 Dec 2008 21:57:24 -0800

On Dec 7, 2008, at 11:45 AM, Frank Thieme wrote:

Hi!

After years I'm back on Emacs. At the moment I'm writing a PHP/Mysql
project and wonder how I can get some indentation on the SQL statements
within PHP code.

When I write function calls like

foo($bar,
   $foobar);

I can indent pressing <Tab> key. But when I do same for SQL just nothing
happens:

$query = "SELECT foo
FROM bar
WHERE foobar"

I have to manually indent...

any hints?

There's no easy solution, unfortunately. I think the only thing you can do is et up MMM or MuMaMo so those regions are sql-mode instead of php-mode, and use sql-indent.el.

I've never had the patience to get either of those working, so I just align it by hand in the source, or edit the query in a *SQL* buffer, then dump it into the source in a here document.

 - Ian




reply via email to

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