aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-12-11 13:51:12 +0400
committerDmitry Antipov2012-12-11 13:51:12 +0400
commitc6afe371b0218154957bbef17c3f8bda5377b7c8 (patch)
tree2356c637109538cac1d24a7e1ae0ba38ccfec53d /src
parent1b47babdb7fd503ad79a696a1b9d9b2e2b46e10c (diff)
downloademacs-c6afe371b0218154957bbef17c3f8bda5377b7c8.tar.gz
emacs-c6afe371b0218154957bbef17c3f8bda5377b7c8.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/buffer.c7
-rw-r--r--src/insdel.c7
-rw-r--r--src/window.c30
4 files changed, 34 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3472dbec611..9d9002ed77b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12012-12-11 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * buffer.c (Fset_buffer_multibyte): Do not force redisplay
4 if changed buffer is not shown in a window.
5 * insdel.c (prepare_to_modify_buffer): Likewise.
6 * window.c (replace_buffer_in_windows_safely): Do nothing
7 if buffer is not shown in a window.
8 (Fforce_window_update): Likewise if string or buffer argument
9 is passed.
10
12012-12-11 Eli Zaretskii <eliz@gnu.org> 112012-12-11 Eli Zaretskii <eliz@gnu.org>
2 12
3 * inotify.c (Finotify_add_watch): Rename decoded_file_name to 13 * inotify.c (Finotify_add_watch): Rename decoded_file_name to
diff --git a/src/buffer.c b/src/buffer.c
index 1194431841a..748422df73a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2691,10 +2691,11 @@ current buffer is cleared. */)
2691 2691
2692 UNGCPRO; 2692 UNGCPRO;
2693 2693
2694 /* Changing the multibyteness of a buffer means that all windows
2695 showing that buffer must be updated thoroughly. */
2696 current_buffer->prevent_redisplay_optimizations_p = 1; 2694 current_buffer->prevent_redisplay_optimizations_p = 1;
2697 ++windows_or_buffers_changed; 2695
2696 /* If buffer is shown in a window, let redisplay consider other windows. */
2697 if (buffer_window_count (current_buffer))
2698 ++windows_or_buffers_changed;
2698 2699
2699 /* Copy this buffer's new multibyte status 2700 /* Copy this buffer's new multibyte status
2700 into all of its indirect buffers. */ 2701 into all of its indirect buffers. */
diff --git a/src/insdel.c b/src/insdel.c
index 5803a48e949..74e938c4b8c 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1800,9 +1800,10 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1800 if (!NILP (BVAR (current_buffer, read_only))) 1800 if (!NILP (BVAR (current_buffer, read_only)))
1801 Fbarf_if_buffer_read_only (); 1801 Fbarf_if_buffer_read_only ();
1802 1802
1803 /* Let redisplay consider other windows than selected_window 1803 /* If we're modifying the buffer other than shown in a selected window,
1804 if modifying another buffer. */ 1804 let redisplay consider other windows if this buffer is visible. */
1805 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1805 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer
1806 && buffer_window_count (current_buffer))
1806 ++windows_or_buffers_changed; 1807 ++windows_or_buffers_changed;
1807 1808
1808 if (buffer_intervals (current_buffer)) 1809 if (buffer_intervals (current_buffer))
diff --git a/src/window.c b/src/window.c
index 17489cb95e9..f696e3c2a1b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2988,22 +2988,24 @@ replace_buffer_in_windows (Lisp_Object buffer)
2988 call1 (Qreplace_buffer_in_windows, buffer); 2988 call1 (Qreplace_buffer_in_windows, buffer);
2989} 2989}
2990 2990
2991 2991/* If BUFFER is shown in a window, safely replace it with some other
2992/* Safely replace BUFFER with some other buffer in all windows of all 2992 buffer in all windows of all frames, even those on other keyboards. */
2993 frames, even those on other keyboards. */
2994 2993
2995void 2994void
2996replace_buffer_in_windows_safely (Lisp_Object buffer) 2995replace_buffer_in_windows_safely (Lisp_Object buffer)
2997{ 2996{
2998 Lisp_Object tail, frame; 2997 if (buffer_window_count (XBUFFER (buffer)))
2998 {
2999 Lisp_Object tail, frame;
2999 3000
3000 /* A single call to window_loop won't do the job because it only 3001 /* A single call to window_loop won't do the job because it only
3001 considers frames on the current keyboard. So loop manually over 3002 considers frames on the current keyboard. So loop manually over
3002 frames, and handle each one. */ 3003 frames, and handle each one. */
3003 FOR_EACH_FRAME (tail, frame) 3004 FOR_EACH_FRAME (tail, frame)
3004 window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, 1, frame); 3005 window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, 1, frame);
3006 }
3005} 3007}
3006 3008
3007/* If *ROWS or *COLS are too small a size for FRAME, set them to the 3009/* If *ROWS or *COLS are too small a size for FRAME, set them to the
3008 minimum allowable size. */ 3010 minimum allowable size. */
3009 3011
@@ -3338,11 +3340,11 @@ displaying that buffer. */)
3338 3340
3339 if (STRINGP (object)) 3341 if (STRINGP (object))
3340 object = Fget_buffer (object); 3342 object = Fget_buffer (object);
3341 if (BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object))) 3343 if (BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object))
3344 && buffer_window_count (XBUFFER (object)))
3342 { 3345 {
3343 /* Walk all windows looking for buffer, and force update 3346 /* If buffer is live and shown in at least one window, find
3344 of each of those windows. */ 3347 all windows showing this buffer and force update of them. */
3345
3346 object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, 0, Qvisible); 3348 object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, 0, Qvisible);
3347 return NILP (object) ? Qnil : Qt; 3349 return NILP (object) ? Qnil : Qt;
3348 } 3350 }