0

I am using Emacs with a recent version of lua-mode (20200921.1745, commit 345ebfc1e236d9676e7e9f7364493785e7756348) installed with list-packages).

The function align-current is not working as in C mode. How to make it work properly?

Expected:

local Var1 = 1 local Var_2 = 2 local Var_33 = 3 > Call M-x align-current local Var1 = 1 local Var_2 = 2 local Var_33 = 3 

Result: No change at all

local Var1 = 1 local Var_2 = 2 local Var_33 = 3 > Call M-x align-current local Var1 = 1 local Var_2 = 2 local Var_33 = 3 

1 Answer 1

0

After some research, I finally wrote a solution based on Align regexp from emacs lisp and Inconsistent M-x align-regexp vs. C-u M-x align-regexp behaviour :

It's probably not idiomatic, as I assume that there should be a way to change the behavior of align-current in lua-mode, to make it work as c-mode, but I have no idea how to do that. So this solution is probably just a work-around.

(defun lua-align-current () (interactive) (save-excursion (mark-paragraph) (align-regexp (point) (mark) "\\(\\s-*\\)=" 1 1 nil))) 

The key-point was this comment: https://stackoverflow.com/a/14587077/10953006

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.