[Top][All Lists]

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

bug#15938: diff-mode mishandles diff-default-read-only

From: Ivan Shmakov
Subject: bug#15938: diff-mode mishandles diff-default-read-only
Date: Wed, 20 Nov 2013 19:47:29 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

        In addition to making the -*- Diff -*- buffers read-only when
        diff-default-read-only is non-nil, diff-mode also makes such
        buffers /writable/ when diff-default-read-only is nil, while per
        the documentation, I’d expect for diff-mode to have no effect on
        buffer-read-only in this latter case.

        Please consider the patch below, which seems to fix the issue.

--- diff-mode.el.~1~
+++ diff-mode.el        2013-11-20 19:42:41.000000000 +0000
@@ -1366,7 +1366,8 @@ (define-derived-mode diff-mode fundamental-mode "Diff"
-  (setq buffer-read-only diff-default-read-only)
+  (when diff-default-read-only
+    (setq buffer-read-only t))
   ;; setup change hooks
   (if (not diff-update-on-the-fly)
       (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t)

FSF associate member #7257

reply via email to

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