diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-10-15 16:05:33 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-15 16:05:33 +0100 |
commit | 49846fb1a31de99f49d6a7e70efe685197423c84 (patch) | |
tree | 98b3debbaafbd79b05fe941382086792c1aab8ba /src/indent.c | |
parent | 297164cb7972beff35e375ccac4fbad8196ccbd7 (diff) |
patch 9.0.0761: cannot use 'indentexpr' for Lisp indentingv9.0.0761
Problem: Cannot use 'indentexpr' for Lisp indenting.
Solution: Add the 'lispoptions' option.
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/indent.c b/src/indent.c index c6e3aaf33d..aaf3caafc4 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2197,18 +2197,38 @@ 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'. */ 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) |