patch 9.0.0634: evaluating "expr" options has more overhead than needed
Problem: Evaluating "expr" options has more overhead than needed.
Solution: Use call_simple_func() for 'foldtext', 'includeexpr', 'printexpr',
"expr" of 'spellsuggest', 'diffexpr', 'patchexpr', 'balloonexpr',
'formatexpr', 'indentexpr' and 'charconvert'.
diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt
index 2774e98..9f8bb20 100644
--- a/runtime/doc/print.txt
+++ b/runtime/doc/print.txt
@@ -158,13 +158,16 @@
If you change this option, using a function is an easy way to avoid having to
escape all the spaces. Example: >
- :set printexpr=PrintFile(v:fname_in)
- :function PrintFile(fname)
- : call system("ghostview " .. a:fname)
- : call delete(a:fname)
+ :set printexpr=PrintFile()
+ :function PrintFile()
+ : call system("ghostview " .. v:fname_in)
+ : call delete(v:fname_in)
: return v:shell_error
:endfunc
+It is more efficient if the option is set to just a function call,
+see |expr-option-function|.
+
Be aware that some print programs return control before they have read the
file. If you delete the file too soon it will not be printed. These programs
usually offer an option to have them remove the file when printing is done.