From 53dd481c3fc408b0ebf32ae37a5884b3bd47cfee Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 6 Jun 2006 14:06:13 +0000 Subject: * diff-mode.el (diff-mode): Set buffer-read-only to t when diff-default-read-only is non-nill. * diff.el (diff-sentinel, diff): Set inhibit-read-only to t when modifying the *Diff* buffer. (diff-process-filter): New filter function for diff process that sets inhibit-read-only to t when modifying the *Diff* buffer. --- lisp/diff-mode.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/diff-mode.el') diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 1a8402e06c4..f78ce1ae155 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -993,8 +993,7 @@ a diff with \\[diff-reverse-direction]." ;; compile support (set (make-local-variable 'next-error-function) 'diff-next-error) - (when (and (> (point-max) (point-min)) diff-default-read-only) - (toggle-read-only t)) + (setq buffer-read-only diff-default-read-only) ;; setup change hooks (if (not diff-update-on-the-fly) (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t) -- cgit v1.2.1 From dd24cb375fc84ea98e672da58b5ba814ef8ba472 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 6 Jun 2006 14:17:31 +0000 Subject: * diff-mode.el (diff-hunk-kill, diff-file-kill, diff-split-hunk) (diff-refine-hunk): Set inhibit-read-only to t. --- lisp/diff-mode.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lisp/diff-mode.el') diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index f78ce1ae155..7ea02352b0b 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -438,7 +438,8 @@ If the prefix ARG is given, restrict the view to the current file instead." (firsthunk (ignore-errors (goto-char start) (diff-beginning-of-file) (diff-hunk-next) (point))) - (nextfile (ignore-errors (diff-file-next) (point)))) + (nextfile (ignore-errors (diff-file-next) (point))) + (inhibit-read-only t)) (goto-char start) (if (and firsthunk (= firsthunk start) (or (null nexthunk) @@ -457,7 +458,8 @@ If the prefix ARG is given, restrict the view to the current file instead." (ignore-errors (diff-hunk-prev) (point)))) (index (save-excursion - (re-search-backward "^Index: " prevhunk t)))) + (re-search-backward "^Index: " prevhunk t))) + (inhibit-read-only t)) (when index (setq start index)) (diff-end-of-file) (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs. @@ -497,7 +499,8 @@ If the prefix ARG is given, restrict the view to the current file instead." (let* ((start1 (string-to-number (match-string 1))) (start2 (string-to-number (match-string 2))) (newstart1 (+ start1 (diff-count-matches "^[- \t]" (point) pos))) - (newstart2 (+ start2 (diff-count-matches "^[+ \t]" (point) pos)))) + (newstart2 (+ start2 (diff-count-matches "^[+ \t]" (point) pos))) + (inhibit-read-only t)) (goto-char pos) ;; Hopefully the after-change-function will not screw us over. (insert "@@ -" (number-to-string newstart1) ",1 +" @@ -1354,6 +1357,7 @@ For use in `add-log-current-defun-function'." (file1 (make-temp-file "diff1")) (file2 (make-temp-file "diff2")) (coding-system-for-read buffer-file-coding-system) + (inhibit-read-only t) old new) (unwind-protect (save-excursion -- cgit v1.2.1