summaryrefslogtreecommitdiff
path: root/src/indent.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-07-23 17:43:40 +0300
committerEli Zaretskii <eliz@gnu.org>2022-07-23 17:43:40 +0300
commitfc53961c1df8bee07b6a1d461d31f449b66f1d65 (patch)
tree09cf32b15c81c3b99b392f297d8a73680f134584 /src/indent.c
parent350e97d78e7803650c6dd2bf46fcfece8e2b4b32 (diff)
downloademacs-fc53961c1df8bee07b6a1d461d31f449b66f1d65.tar.gz
Avoid calling 'current_column' in buffers with long lines.
* src/xdisp.c (decode_mode_spec, redisplay_window) (mode_line_update_needed): * src/indent.c (Fcurrent_column): In a buffer with long-line optimizations enabled, avoid calling 'current_column', which is very slow in that case.
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/indent.c b/src/indent.c
index d4ef075f001..e90e3fde203 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -306,6 +306,8 @@ and point (e.g., control characters will have a width of 2 or 4, tabs
will have a variable width).
Ignores finite width of frame, which means that this function may return
values greater than (frame-width).
+In a buffer with very long lines, the value can be zero, because calculating
+the exact number is very expensive.
Whether the line is visible (if `selective-display' is t) has no effect;
however, ^M is treated as end of line when `selective-display' is t.
Text that has an invisible property is considered as having width 0, unless
@@ -313,6 +315,9 @@ Text that has an invisible property is considered as having width 0, unless
(void)
{
Lisp_Object temp;
+
+ if (current_buffer->long_line_optimizations_p)
+ return make_fixnum (0);
XSETFASTINT (temp, current_column ());
return temp;
}