bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#1655: 23.0.60; visiting tarball marks the buffer as modified


From: Sven Joachim
Subject: bug#1655: 23.0.60; visiting tarball marks the buffer as modified
Date: Tue, 23 Dec 2008 17:27:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

tags 1655 + patch
thanks

On 2008-12-23 12:44 +0100, Sven Joachim wrote:

> On 2008-12-21 10:13 +0100, Sven Joachim wrote:
>
>> Visiting a tar archive results in the buffer containing its contents
>> being marked as modified.
>
> While this showed up fairly recently, the problem probably has existed
> for much longer, but had been hidden by bug #1509 (epa-find-file-hook
> marking the buffer as unmodified).
>
> Will investigate this issue further if time permits.

Found out that the problem is in the buffer-swap-text calls in tar-mode
and tar-change-major-mode-hook that change the buffer.  The following
patch works for me:

2008-12-23  Sven Joachim  <svenjoac@gmx.de>

        * tar-mode.el (tar-mode, tar-change-major-mode-hook): Avoid
        marking buffer as modified.

--8<---------------cut here---------------start------------->8---
--- tar-mode.el.~1.130.~        2008-06-01 10:42:56.000000000 +0200
+++ tar-mode.el 2008-12-23 17:11:12.000000000 +0100
@@ -577,8 +577,10 @@
 (put 'tar-subfile-mode 'mode-class 'special)
 
 (defun tar-change-major-mode-hook ()
-  ;; Bring the actual Tar data back into the main buffer.
-  (when (tar-data-swapped-p) (buffer-swap-text tar-data-buffer))
+  (let ((modified-p (buffer-modified-p)))
+    ;; Bring the actual Tar data back into the main buffer.
+    (when (tar-data-swapped-p) (buffer-swap-text tar-data-buffer))
+    (restore-buffer-modified-p modified-p))
   ;; Throw away the summary.
   (when (buffer-live-p tar-data-buffer) (kill-buffer tar-data-buffer)))
 
@@ -630,8 +632,10 @@
        (generate-new-buffer (format " *tar-data %s*"
                                     (file-name-nondirectory
                                      (or buffer-file-name (buffer-name))))))
-  (buffer-swap-text tar-data-buffer)
-  (tar-summarize-buffer)
+  (let ((modified-p (buffer-modified-p)))
+    (buffer-swap-text tar-data-buffer)
+    (tar-summarize-buffer)
+    (restore-buffer-modified-p modified-p))
   (tar-next-line 0))
--8<---------------cut here---------------end--------------->8---







reply via email to

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