summaryrefslogtreecommitdiff
path: root/lisp/diff.el
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-06-12 07:27:12 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-06-12 07:27:12 +0000
commit476e9367ec1f440aa23904b7bc482ea4a3b8041c (patch)
tree4f7f5a5e9a6668f908834bb6e216c8fa3727d4b3 /lisp/diff.el
parenta13f8f50d4cc544d3bbfa78568e82ce09e68bded (diff)
parent6b519504c3297595101628e823e72c91e562ab45 (diff)
downloademacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.tar.gz
Merged from emacs@sv.gnu.org.
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-294 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-295 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-296 Update from CVS: admin/FOR-RELEASE: Update refcard section. * emacs@sv.gnu.org/emacs--devo--0--patch-297 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-298 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-299 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-300 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-301 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-302 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-303 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-304 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-103 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-104 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
Diffstat (limited to 'lisp/diff.el')
-rw-r--r--lisp/diff.el32
1 files changed, 24 insertions, 8 deletions
diff --git a/lisp/diff.el b/lisp/diff.el
index 221d7b2e363..534a84d4317 100644
--- a/lisp/diff.el
+++ b/lisp/diff.el
@@ -67,9 +67,10 @@ CODE is the exit code of the process. It should be 0 iff no diffs were found."
(if diff-new-temp-file (delete-file diff-new-temp-file))
(save-excursion
(goto-char (point-max))
- (insert (format "\nDiff finished%s. %s\n"
- (if (equal 0 code) " (no differences)" "")
- (current-time-string)))))
+ (let ((inhibit-read-only t))
+ (insert (format "\nDiff finished%s. %s\n"
+ (if (equal 0 code) " (no differences)" "")
+ (current-time-string))))))
;;;###autoload
(defun diff (old new &optional switches no-async)
@@ -119,7 +120,8 @@ With prefix arg, prompt for diff switches."
(set-buffer buf)
(setq buffer-read-only nil)
(buffer-disable-undo (current-buffer))
- (erase-buffer)
+ (let ((inhibit-read-only t))
+ (erase-buffer))
(buffer-enable-undo (current-buffer))
(diff-mode)
(set (make-local-variable 'revert-buffer-function)
@@ -128,21 +130,35 @@ With prefix arg, prompt for diff switches."
(set (make-local-variable 'diff-old-temp-file) old-alt)
(set (make-local-variable 'diff-new-temp-file) new-alt)
(setq default-directory thisdir)
- (insert command "\n")
+ (let ((inhibit-read-only t))
+ (insert command "\n"))
(if (and (not no-async) (fboundp 'start-process))
(progn
(setq proc (start-process "Diff" buf shell-file-name
shell-command-switch command))
+ (set-process-filter proc 'diff-process-filter)
(set-process-sentinel
proc (lambda (proc msg)
(with-current-buffer (process-buffer proc)
(diff-sentinel (process-exit-status proc))))))
;; Async processes aren't available.
- (diff-sentinel
- (call-process shell-file-name nil buf nil
- shell-command-switch command))))
+ (let ((inhibit-read-only t))
+ (diff-sentinel
+ (call-process shell-file-name nil buf nil
+ shell-command-switch command)))))
buf))
+(defun diff-process-filter (proc string)
+ (with-current-buffer (process-buffer proc)
+ (let ((moving (= (point) (process-mark proc))))
+ (save-excursion
+ ;; Insert the text, advancing the process marker.
+ (goto-char (process-mark proc))
+ (let ((inhibit-read-only t))
+ (insert string))
+ (set-marker (process-mark proc) (point)))
+ (if moving (goto-char (process-mark proc))))))
+
;;;###autoload
(defun diff-backup (file &optional switches)
"Diff this file with its backup file or vice versa.