Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs indent-line-function

Tags:

emacs

elisp

i try to indent sql file lines in emacs, I think the c-indent-line is pretty good for me, so i write this code to my init file:

(defun my-sql-mode ()
    (setq indent-line-function 'c-indent-line)
    )

(add-hook 'sql-mode-hook 'my-sql-mode)

But when i use tab to indent the line, it always give me the tips of 'Wrong type argument: stringp, nil'.

Can someone help me?

like image 505
Tian Yong Avatar asked Jun 20 '26 08:06

Tian Yong


1 Answers

Indentation in Emacs is generally intelligent, but it's not magic.

c-indent-line is a function designed for use with C and C++ code. It shouldn't be greatly surprising that it might not work in other contexts, and I'm not sure what you were expecting it to do when faced with SQL code?

I'm afraid the answer is simply: Don't do that.

If you tell us what you wanted it to do, however, someone might be able to help.

like image 119
phils Avatar answered Jun 22 '26 21:06

phils



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!