emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111189: * buffer.c (Fset_buffer_mult


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111189: * buffer.c (Fset_buffer_multibyte): Do not force redisplay
Date: Tue, 11 Dec 2012 13:51:12 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111189
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2012-12-11 13:51:12 +0400
message:
  * 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.
modified:
  src/ChangeLog
  src/buffer.c
  src/insdel.c
  src/window.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-11 08:24:09 +0000
+++ b/src/ChangeLog     2012-12-11 09:51:12 +0000
@@ -1,3 +1,13 @@
+2012-12-11  Dmitry Antipov  <address@hidden>
+
+       * 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  <address@hidden>
 
        * inotify.c (Finotify_add_watch): Rename decoded_file_name to

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-12-10 17:34:47 +0000
+++ b/src/buffer.c      2012-12-11 09:51:12 +0000
@@ -2691,10 +2691,11 @@
 
   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;
-  ++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
      into all of its indirect buffers.  */

=== modified file 'src/insdel.c'
--- a/src/insdel.c      2012-12-11 06:08:53 +0000
+++ b/src/insdel.c      2012-12-11 09:51:12 +0000
@@ -1800,9 +1800,10 @@
   if (!NILP (BVAR (current_buffer, read_only)))
     Fbarf_if_buffer_read_only ();
 
-  /* Let redisplay consider other windows than selected_window
-     if modifying another buffer.  */
-  if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
+  /* If we're modifying the buffer other than shown in a selected window,
+     let redisplay consider other windows if this buffer is visible.  */
+  if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer
+      && buffer_window_count (current_buffer))
     ++windows_or_buffers_changed;
 
   if (buffer_intervals (current_buffer))

=== modified file 'src/window.c'
--- a/src/window.c      2012-12-11 06:08:53 +0000
+++ b/src/window.c      2012-12-11 09:51:12 +0000
@@ -2988,22 +2988,24 @@
   call1 (Qreplace_buffer_in_windows, buffer);
 }
 
-
-/* Safely replace BUFFER with some other buffer in all windows of all
-   frames, even those on other keyboards.  */
+/* If BUFFER is shown in a window, safely replace it with some other
+   buffer in all windows of all frames, even those on other keyboards.  */
 
 void
 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
-     considers frames on the current keyboard.  So loop manually over
-     frames, and handle each one.  */
-  FOR_EACH_FRAME (tail, frame)
-    window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, 1, frame);
+      /* A single call to window_loop won't do the job because it only
+        considers frames on the current keyboard.  So loop manually over
+        frames, and handle each one.  */
+      FOR_EACH_FRAME (tail, 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
    minimum allowable size.  */
 
@@ -3338,11 +3340,11 @@
 
   if (STRINGP (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
-        of each of those windows.  */
-
+      /* If buffer is live and shown in at least one window, find
+        all windows showing this buffer and force update of them.  */
       object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, 0, Qvisible);
       return NILP (object) ? Qnil : Qt;
     }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]