Mercurial > emacs
changeset 16984:100ef50c2c01
* (diff-process-setup): New function, sets up the
compilation-exit-message-function so that it works with both
asynchronous and synchronous sub-processes.
(diff): Bind compilation-exit-message-function. Run
compilation-finish-function when compile-internal returns if async
processes aren't supported.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 09 Feb 1997 15:57:11 +0000 |
parents | 8c94c682773a |
children | b0d8e7c0f906 |
files | lisp/diff.el |
diffstat | 1 files changed, 21 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/diff.el Sat Feb 08 20:17:04 1997 +0000 +++ b/lisp/diff.el Sun Feb 09 15:57:11 1997 +0000 @@ -160,6 +160,21 @@ (message "Parsing differences...done")) (setq compilation-error-list (nreverse compilation-error-list))) +(defun diff-process-setup () + "Set up \`compilation-exit-message-function' for \`diff'." + ;; Avoid frightening people with "abnormally terminated" + ;; if diff finds differences. + (set (make-local-variable 'compilation-exit-message-function) + (lambda (status code msg) + (cond ((not (eq status 'exit)) + (cons msg code)) + ((zerop code) + '("finished (no differences)\n" . "no differences")) + ((= code 1) + '("finished\n" . "differences found")) + (t + (cons msg code)))))) + ;;;###autoload (defun diff (old new &optional switches) "Find and display the differences between OLD and NEW files. @@ -198,7 +213,8 @@ (new-alt (file-local-copy new)) buf) (save-excursion - (let ((command + (let ((compilation-process-setup-function 'diff-process-setup) + (command (mapconcat 'identity (append (list diff-command) ;; Use explicitly specified switches @@ -221,18 +237,6 @@ "No more differences" "Diff" 'diff-parse-differences)) (set-buffer buf) - ;; Avoid frightening people with "abnormally terminated" - ;; if diff finds differences. - (set (make-local-variable 'compilation-exit-message-function) - (lambda (status code msg) - (cond ((not (eq status 'exit)) - (cons msg code)) - ((zerop code) - '("finished (no differences)\n" . "no differences")) - ((= code 1) - '("finished\n" . "differences found")) - (t - (cons msg code))))) (set (make-local-variable 'diff-old-file) old) (set (make-local-variable 'diff-new-file) new) (set (make-local-variable 'diff-old-temp-file) old-alt) @@ -243,6 +247,10 @@ (delete-file diff-old-temp-file)) (if diff-new-temp-file (delete-file diff-new-temp-file))))) + ;; When async processes aren't available, the compilation finish + ;; function doesn't get chance to run. Invoke it by hand. + (or (fboundp 'start-process) + (funcall compilation-finish-function nil nil)) buf)))) ;;;###autoload