What is elisp or macromagy can do this text conversion?

I have a set of SQL statements formatted like this:

INSERT INTO reports.workload (workload_id,event_time,event_type_id,agent_id) VALUES 
                             (-42000,'2010-02-23 07:30:38.941436',1,NULL);

Right now, the VALUES tuple is aligned at the beginning with the root name of the column. However, I want the tuple elements to be aligned as well, for example:

INSERT INTO reports.workload (workload_id,event_time,                  event_type_id,agent_id) VALUES 
                             (-42000,     '2010-02-23 07:30:38.941436',1            ,NULL);

My elisp-fu and regexp-fu are moderate, but not enough to complete this task. How can i do this?

+3
source share
1 answer

Select the region you want to align and enter C-u C-x \(this is a shortcut for align-regexp). Select \(,\)as a regular expression pattern and repeat it all the way.

. AlignCommands EmacsWiki.

+5

Source: https://habr.com/ru/post/1735078/


All Articles