From 3e1451520bdae2a79247347e66724306692533f6 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 1 Sep 2006 13:28:13 +0000 Subject: * buffer.h (struct buffer_text): New field chars_modiff. (CHARS_MODIFF, BUF_CHARS_MODIFF): New macros. * buffer.c (Fbuffer_chars_modified_tick): New function returning value of BUF_CHARS_MODIFF. (syms_of_buffer): Defsubr it. (Fget_buffer_create): Initialize BUF_CHARS_MODIFF. * insdel.c (modify_region): New argument preserve_chars_modiff. Set CHARS_MODIFF to MODIFF provided preserve_chars_modiff is zero. (insert_1_both, insert_from_string_1, insert_from_buffer_1) (adjust_after_replace, adjust_after_replace_noundo) (replace_range, replace_range_2, del_range_2): Reset CHARS_MODIFF. * lisp.h (modify_region): Add fourth argument in extern. * casefiddle.c (casify_region): Call modify_region with fourth argument zero to assert that CHARS_MODIFF is updated. * editfns.c (Fsubst_char_in_region, Ftranslate_region_internal) (Ftranspose_regions): Likewise. * textprop.c (Fadd_text_properties, Fset_text_properties) (Fremove_text_properties, Fremove_list_of_text_properties): Call modify_region with fourth argument 1 to avoid that CHARS_MODIFF is updated. --- src/buffer.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 863b217d2b4..58c047a87ba 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -374,6 +374,7 @@ The value is never nil. */) BUF_ZV_BYTE (b) = BEG_BYTE; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; + BUF_CHARS_MODIFF (b) = 1; BUF_OVERLAY_MODIFF (b) = 1; BUF_SAVE_MODIFF (b) = 1; BUF_INTERVALS (b) = 0; @@ -1148,6 +1149,31 @@ No argument or nil as argument means use current buffer as BUFFER. */) return make_number (BUF_MODIFF (buf)); } + +DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick, + Sbuffer_chars_modified_tick, 0, 1, 0, + doc: /* Return BUFFER's character-change tick counter. +Each buffer has a character-change tick counter, which is set to the +value of the buffer's tick counter \(see `buffer-modified-tick'), each +time text in that buffer is inserted or deleted. By comparing the +values returned by two individual calls of buffer-chars-modified-tick, +you can tell whether a character change occurred in that buffer in +between these calls. No argument or nil as argument means use current +buffer as BUFFER. */) + (buffer) + register Lisp_Object buffer; +{ + register struct buffer *buf; + if (NILP (buffer)) + buf = current_buffer; + else + { + CHECK_BUFFER (buffer); + buf = XBUFFER (buffer); + } + + return make_number (BUF_CHARS_MODIFF (buf)); +} DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, "sRename buffer (to new name): \nP", @@ -6044,6 +6070,7 @@ The function `kill-all-local-variables' runs this before doing anything else. * defsubr (&Sbuffer_modified_p); defsubr (&Sset_buffer_modified_p); defsubr (&Sbuffer_modified_tick); + defsubr (&Sbuffer_chars_modified_tick); defsubr (&Srename_buffer); defsubr (&Sother_buffer); defsubr (&Sbuffer_enable_undo); -- cgit v1.2.1 From 12bd42bee527dfca469e4604ab23cd9e5d3e0626 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 1 Sep 2006 13:35:11 +0000 Subject: Minor doc fix. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 58c047a87ba..51f93c930e5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1156,7 +1156,7 @@ DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick, Each buffer has a character-change tick counter, which is set to the value of the buffer's tick counter \(see `buffer-modified-tick'), each time text in that buffer is inserted or deleted. By comparing the -values returned by two individual calls of buffer-chars-modified-tick, +values returned by two individual calls of `buffer-chars-modified-tick', you can tell whether a character change occurred in that buffer in between these calls. No argument or nil as argument means use current buffer as BUFFER. */) -- cgit v1.2.1 From 474198601d784615913a77e40e50912591763da6 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 29 Sep 2006 21:15:25 +0000 Subject: (syms_of_buffer): Reorder coding systems in the docstring of %z to the real order displayed in the modeline. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 51f93c930e5..c02637ff0c5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5491,7 +5491,7 @@ A string is printed verbatim in the mode line except for %-constructs: or print Bottom or All. %n -- print Narrow if appropriate. %t -- visited file is text or binary (if OS supports this distinction). - %z -- print mnemonics of buffer, terminal, and keyboard coding systems. + %z -- print mnemonics of keyboard, terminal, and buffer coding systems. %Z -- like %z, but including the end-of-line format. %e -- print error message about full memory. %[ -- print one [ for each recursive editing level. %] similar. -- cgit v1.2.1