diff options
| author | Richard M. Stallman | 1995-07-20 20:47:40 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-07-20 20:47:40 +0000 |
| commit | c8e76b4733827056fdd050eefc9d2346083181ca (patch) | |
| tree | eff0f3e34f2c864d76f93ad137599a5ee880a4a9 /src | |
| parent | ab6c5c0c36488f1cf8c42f24325a5829bcdaaed5 (diff) | |
| download | emacs-c8e76b4733827056fdd050eefc9d2346083181ca.tar.gz emacs-c8e76b4733827056fdd050eefc9d2346083181ca.zip | |
(Fsubst_char_in_region): Bind buffer-file-name to nil if NOUNDO is true.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c index 4a92eb8b6f2..ba9e922eb6e 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1378,6 +1378,13 @@ subst_char_in_region_unwind (arg) | |||
| 1378 | return current_buffer->undo_list = arg; | 1378 | return current_buffer->undo_list = arg; |
| 1379 | } | 1379 | } |
| 1380 | 1380 | ||
| 1381 | static Lisp_Object | ||
| 1382 | subst_char_in_region_unwind_1 (arg) | ||
| 1383 | Lisp_Object arg; | ||
| 1384 | { | ||
| 1385 | return current_buffer->filename = arg; | ||
| 1386 | } | ||
| 1387 | |||
| 1381 | DEFUN ("subst-char-in-region", Fsubst_char_in_region, | 1388 | DEFUN ("subst-char-in-region", Fsubst_char_in_region, |
| 1382 | Ssubst_char_in_region, 4, 5, 0, | 1389 | Ssubst_char_in_region, 4, 5, 0, |
| 1383 | "From START to END, replace FROMCHAR with TOCHAR each time it occurs.\n\ | 1390 | "From START to END, replace FROMCHAR with TOCHAR each time it occurs.\n\ |
| @@ -1400,12 +1407,17 @@ and don't mark the buffer as really changed.") | |||
| 1400 | 1407 | ||
| 1401 | /* If we don't want undo, turn off putting stuff on the list. | 1408 | /* If we don't want undo, turn off putting stuff on the list. |
| 1402 | That's faster than getting rid of things, | 1409 | That's faster than getting rid of things, |
| 1403 | and it prevents even the entry for a first change. */ | 1410 | and it prevents even the entry for a first change. |
| 1411 | Also inhibit locking the file. */ | ||
| 1404 | if (!NILP (noundo)) | 1412 | if (!NILP (noundo)) |
| 1405 | { | 1413 | { |
| 1406 | record_unwind_protect (subst_char_in_region_unwind, | 1414 | record_unwind_protect (subst_char_in_region_unwind, |
| 1407 | current_buffer->undo_list); | 1415 | current_buffer->undo_list); |
| 1408 | current_buffer->undo_list = Qt; | 1416 | current_buffer->undo_list = Qt; |
| 1417 | /* Don't do file-locking. */ | ||
| 1418 | record_unwind_protect (subst_char_in_region_unwind_1, | ||
| 1419 | current_buffer->filename); | ||
| 1420 | current_buffer->filename = Qnil; | ||
| 1409 | } | 1421 | } |
| 1410 | 1422 | ||
| 1411 | while (pos < stop) | 1423 | while (pos < stop) |