summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPip Cet <pipcet@protonmail.com>2026-05-24 11:51:38 +0000
committerPip Cet <pipcet@protonmail.com>2026-05-24 11:51:38 +0000
commit7f8ac8bf6f04045a676543862098c47bbf732f9e (patch)
tree5e5466ef8b18a8aea56e66664382f1e27d21d38e /src
parent94dbab2fe45fdcdcefc3a19ecf6c2063eecc1df2 (diff)
Avoid crash in self-insert-command for peculiar arguments
* src/cmds.c (internal_self_insert): Don't call auto-fill-function after inserting zero newlines. * test/src/cmds-tests.el (self-insert-zero-newlines): New.
Diffstat (limited to 'src')
-rw-r--r--src/cmds.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmds.c b/src/cmds.c
index 99e436e65c1..e9dee5ed2e3 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -477,7 +477,8 @@ internal_self_insert (int c, EMACS_INT n)
if ((CHAR_TABLE_P (Vauto_fill_chars)
? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
: (c == ' ' || c == '\n'))
- && !NILP (BVAR (current_buffer, auto_fill_function)))
+ && !NILP (BVAR (current_buffer, auto_fill_function))
+ && n > 0)
{
Lisp_Object auto_fill_result;