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?
Indentation in Emacs is generally intelligent, but it’s not magic.
c-indent-lineis 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.