Commit c6afe371 authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

* buffer.c (Fset_buffer_multibyte): Do not force redisplay

if changed buffer is not shown in a window.
* insdel.c (prepare_to_modify_buffer): Likewise.
* window.c (replace_buffer_in_windows_safely): Do nothing
if buffer is not shown in a window.
(Fforce_window_update): Likewise if string or buffer argument
is passed.
parent 1b47babd
2012-12-11 Dmitry Antipov <dmantipov@yandex.ru>
* buffer.c (Fset_buffer_multibyte): Do not force redisplay
if changed buffer is not shown in a window.
* insdel.c (prepare_to_modify_buffer): Likewise.
* window.c (replace_buffer_in_windows_safely): Do nothing
if buffer is not shown in a window.
(Fforce_window_update): Likewise if string or buffer argument
is passed.
2012-12-11 Eli Zaretskii <eliz@gnu.org> 2012-12-11 Eli Zaretskii <eliz@gnu.org>
   
* inotify.c (Finotify_add_watch): Rename decoded_file_name to * inotify.c (Finotify_add_watch): Rename decoded_file_name to
......
...@@ -2691,10 +2691,11 @@ current buffer is cleared. */) ...@@ -2691,10 +2691,11 @@ current buffer is cleared. */)
UNGCPRO; UNGCPRO;
/* Changing the multibyteness of a buffer means that all windows
showing that buffer must be updated thoroughly. */
current_buffer->prevent_redisplay_optimizations_p = 1; current_buffer->prevent_redisplay_optimizations_p = 1;
++windows_or_buffers_changed;
/* If buffer is shown in a window, let redisplay consider other windows. */
if (buffer_window_count (current_buffer))
++windows_or_buffers_changed;
/* Copy this buffer's new multibyte status /* Copy this buffer's new multibyte status
into all of its indirect buffers. */ into all of its indirect buffers. */
......
...@@ -1800,9 +1800,10 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, ...@@ -1800,9 +1800,10 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
if (!NILP (BVAR (current_buffer, read_only))) if (!NILP (BVAR (current_buffer, read_only)))
Fbarf_if_buffer_read_only (); Fbarf_if_buffer_read_only ();
/* Let redisplay consider other windows than selected_window /* If we're modifying the buffer other than shown in a selected window,
if modifying another buffer. */ let redisplay consider other windows if this buffer is visible. */
if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer
&& buffer_window_count (current_buffer))
++windows_or_buffers_changed; ++windows_or_buffers_changed;
if (buffer_intervals (current_buffer)) if (buffer_intervals (current_buffer))
......
...@@ -2988,22 +2988,24 @@ replace_buffer_in_windows (Lisp_Object buffer) ...@@ -2988,22 +2988,24 @@ replace_buffer_in_windows (Lisp_Object buffer)
call1 (Qreplace_buffer_in_windows, buffer); call1 (Qreplace_buffer_in_windows, buffer);
} }
/* If BUFFER is shown in a window, safely replace it with some other
/* Safely replace BUFFER with some other buffer in all windows of all buffer in all windows of all frames, even those on other keyboards. */
frames, even those on other keyboards. */
void void
replace_buffer_in_windows_safely (Lisp_Object buffer) replace_buffer_in_windows_safely (Lisp_Object buffer)
{ {
Lisp_Object tail, frame; if (buffer_window_count (XBUFFER (buffer)))
{
Lisp_Object tail, frame;
/* A single call to window_loop won't do the job because it only /* A single call to window_loop won't do the job because it only
considers frames on the current keyboard. So loop manually over considers frames on the current keyboard. So loop manually over
frames, and handle each one. */ frames, and handle each one. */
FOR_EACH_FRAME (tail, frame) FOR_EACH_FRAME (tail, frame)
window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, 1, frame); window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, 1, frame);
}
} }
/* If *ROWS or *COLS are too small a size for FRAME, set them to the /* If *ROWS or *COLS are too small a size for FRAME, set them to the
minimum allowable size. */ minimum allowable size. */
...@@ -3338,11 +3340,11 @@ displaying that buffer. */) ...@@ -3338,11 +3340,11 @@ displaying that buffer. */)
if (STRINGP (object)) if (STRINGP (object))
object = Fget_buffer (object); object = Fget_buffer (object);
if (BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object))) if (BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object))
&& buffer_window_count (XBUFFER (object)))
{ {
/* Walk all windows looking for buffer, and force update /* If buffer is live and shown in at least one window, find
of each of those windows. */ all windows showing this buffer and force update of them. */
object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, 0, Qvisible); object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, 0, Qvisible);
return NILP (object) ? Qnil : Qt; return NILP (object) ? Qnil : Qt;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment