0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.0761: cannot use 'indentexpr' for Lisp indenting

Problem:    Cannot use 'indentexpr' for Lisp indenting.
Solution:   Add the 'lispoptions' option.
This commit is contained in:
Bram Moolenaar
2022-10-15 16:05:33 +01:00
parent 297164cb79
commit 49846fb1a3
11 changed files with 95 additions and 24 deletions

View File

@@ -2196,6 +2196,22 @@ fixthisline(int (*get_the_indent)(void))
}
}
/*
* Return TRUE if 'indentexpr' should be used for Lisp indenting.
* Caller may want to check 'autoindent'.
*/
int
use_indentexpr_for_lisp(void)
{
#ifdef FEAT_EVAL
return curbuf->b_p_lisp
&& *curbuf->b_p_inde != NUL
&& STRCMP(curbuf->b_p_lop, "expr:1") == 0;
#else
return FALSE;
#endif
}
/*
* Fix indent for 'lisp' and 'cindent'.
*/
@@ -2203,12 +2219,16 @@ fixthisline(int (*get_the_indent)(void))
fix_indent(void)
{
if (p_paste)
return;
return; // no auto-indenting when 'paste' is set
if (curbuf->b_p_lisp && curbuf->b_p_ai)
fixthisline(get_lisp_indent);
else
if (cindent_on())
{
if (use_indentexpr_for_lisp())
do_c_expr_indent();
else
fixthisline(get_lisp_indent);
}
else if (cindent_on())
do_c_expr_indent();
}
#if defined(FEAT_EVAL) || defined(PROTO)