aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorStefan Monnier2025-05-02 16:59:17 -0400
committerStefan Monnier2025-05-02 17:06:09 -0400
commit9048fcf22c3ec3b5cc77dbb98993a53f5f9b7cd5 (patch)
treed633384235b0038f3aa3568f096367374493a1e6 /src/coding.c
parent99ca41b6ef300653a0d15b73a0c0d446a9a9e059 (diff)
downloademacs-9048fcf22c3ec3b5cc77dbb98993a53f5f9b7cd5.tar.gz
emacs-9048fcf22c3ec3b5cc77dbb98993a53f5f9b7cd5.zip
(decode_coding): Avoid nested *-change-functions (bug#78042)
* src/coding.c (decode_coding): Avoid nested *-change-functions (bug#78042). * test/src/editfns-tests.el (sanity-check-change-functions-before) (sanity-check-change-functions-after): Record notifications in `sanity-check-change-functions-op`. (sanity-check-change-functions-with-op): Don't rely on `sanity-check-change-functions-op` always holding only the `op`. (sanity-check-change-functions-errors): Include the sequence of notifications in the error info. (editfns-tests--before/after-change-functions): Add tests for (bug#78042).
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/coding.c b/src/coding.c
index 63b0dbeb18b..a923b6bd82d 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7363,6 +7363,7 @@ decode_coding (struct coding_system *coding)
7363 struct ccl_spec cclspec; 7363 struct ccl_spec cclspec;
7364 int carryover; 7364 int carryover;
7365 int i; 7365 int i;
7366 specpdl_ref count = SPECPDL_INDEX ();
7366 7367
7367 USE_SAFE_ALLOCA; 7368 USE_SAFE_ALLOCA;
7368 7369
@@ -7389,6 +7390,9 @@ decode_coding (struct coding_system *coding)
7389 7390
7390 undo_list = BVAR (current_buffer, undo_list); 7391 undo_list = BVAR (current_buffer, undo_list);
7391 bset_undo_list (current_buffer, Qt); 7392 bset_undo_list (current_buffer, Qt);
7393 /* Avoid running nested *-change-functions via 'produce_annotation'.
7394 Our callers run *-change-functions over the whole region anyway. */
7395 specbind (Qinhibit_modification_hooks, Qt);
7392 } 7396 }
7393 7397
7394 coding->consumed = coding->consumed_char = 0; 7398 coding->consumed = coding->consumed_char = 0;
@@ -7501,7 +7505,7 @@ decode_coding (struct coding_system *coding)
7501 record_insert (coding->dst_pos, coding->produced_char); 7505 record_insert (coding->dst_pos, coding->produced_char);
7502 } 7506 }
7503 7507
7504 SAFE_FREE (); 7508 SAFE_FREE_UNBIND_TO (count, Qnil);
7505} 7509}
7506 7510
7507 7511