emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110127: Fix auto-save and locking fo


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110127: Fix auto-save and locking for indirect buffers.
Date: Sat, 22 Sep 2012 11:07:39 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110127
fixes bug: http://debbugs.gnu.org/8207
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-09-22 11:07:39 +0800
message:
  Fix auto-save and locking for indirect buffers.
  
  * lisp/simple.el (undo): Handle indirect buffers.
  
  * buffer.c (Fset_buffer_modified_p): Handle indirect buffers.
modified:
  lisp/ChangeLog
  lisp/simple.el
  src/ChangeLog
  src/buffer.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-21 03:03:48 +0000
+++ b/lisp/ChangeLog    2012-09-22 03:07:39 +0000
@@ -1,3 +1,7 @@
+2012-09-22  Chong Yidong  <address@hidden>
+
+       * simple.el (undo): Handle indirect buffers (Bug#8207).
+
 2012-09-21  Leo Liu  <address@hidden>
 
        IDO: Disable match re-ordering for buffer switching.

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2012-09-07 08:58:31 +0000
+++ b/lisp/simple.el    2012-09-22 03:07:39 +0000
@@ -1855,9 +1855,13 @@
   ;; another undo command will find the undo history empty
   ;; and will get another error.  To begin undoing the undos,
   ;; you must type some other command.
-  (let ((modified (buffer-modified-p))
-       (recent-save (recent-auto-save-p))
-       message)
+  (let* ((modified (buffer-modified-p))
+        ;; For an indirect buffer, look in the base buffer for the
+        ;; auto-save data.
+        (base-buffer (or (buffer-base-buffer) (current-buffer)))
+        (recent-save (with-current-buffer base-buffer
+                       (recent-auto-save-p)))
+        message)
     ;; If we get an error in undo-start,
     ;; the next command should not be a "consecutive undo".
     ;; So set `this-command' to something other than `undo'.
@@ -1935,7 +1939,8 @@
     ;; Record what the current undo list says,
     ;; so the next command can tell if the buffer was modified in between.
     (and modified (not (buffer-modified-p))
-        (delete-auto-save-file-if-necessary recent-save))
+        (with-current-buffer base-buffer
+          (delete-auto-save-file-if-necessary recent-save)))
     ;; Display a message announcing success.
     (if message
        (message "%s" message))))

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-22 02:26:05 +0000
+++ b/src/ChangeLog     2012-09-22 03:07:39 +0000
@@ -1,3 +1,8 @@
+2012-09-22  Chong Yidong  <address@hidden>
+
+       * buffer.c (Fset_buffer_modified_p): Handle indirect buffers
+       (Bug#8207).
+
 2012-09-22  Kenichi Handa  <address@hidden>
 
        * composite.c (composition_reseat_it): Handle the case that a

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-09-15 07:06:56 +0000
+++ b/src/buffer.c      2012-09-22 03:07:39 +0000
@@ -1341,9 +1341,13 @@
   /* If buffer becoming modified, lock the file.
      If buffer becoming unmodified, unlock the file.  */
 
-  fn = BVAR (current_buffer, file_truename);
+  struct buffer *b = current_buffer->base_buffer
+    ? current_buffer->base_buffer
+    : current_buffer;
+
+  fn = BVAR (b, file_truename);
   /* Test buffer-file-name so that binding it to nil is effective.  */
-  if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
+  if (!NILP (fn) && ! NILP (BVAR (b, filename)))
     {
       bool already = SAVE_MODIFF < MODIFF;
       if (!already && !NILP (flag))


reply via email to

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