Function: verilog-diff-file-with-buffer
verilog-diff-file-with-buffer is a byte-compiled function defined in
verilog-mode.el.gz.
Signature
(verilog-diff-file-with-buffer F1 B2 &optional WHITESPACE SHOW)
Documentation
View the differences between file F1 and buffer B2.
This requires the external program diff-command to be in your exec-path(var)/exec-path(fun),
and uses diff-switches(var)/diff-switches(fun) in which you may want to have "-u" flag.
Ignores WHITESPACE if t, and writes output to stdout if SHOW.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-diff-file-with-buffer (f1 b2 &optional whitespace show)
"View the differences between file F1 and buffer B2.
This requires the external program `diff-command' to be in your `exec-path',
and uses `diff-switches' in which you may want to have \"-u\" flag.
Ignores WHITESPACE if t, and writes output to stdout if SHOW."
;; Similar to `diff-buffer-with-file' but works on Emacs 21, and
;; doesn't call `diff' as `diff' has different calling semantics on
;; different versions of Emacs.
(if (not (file-exists-p f1))
(message "Buffer `%s' has no associated file on disk" b2)
(let ((outbuf (get-buffer "*Verilog-Diff*"))
(f2 (make-temp-file "vm-diff-auto-")))
(unwind-protect
;; User may want -u in `diff-switches'.
(let ((args `(,@(if (listp diff-switches)
diff-switches
(list diff-switches))
,@(and whitespace '("-b"))
,f1 ,f2)))
(with-current-buffer b2
(save-restriction
(widen)
(write-region (point-min) (point-max) f2 nil 'nomessage)))
(apply #'call-process diff-command nil outbuf t args)
;; Print out results. Alternatively we could have call-processed
;; ourself, but this way we can reuse diff switches.
(when show
(with-current-buffer outbuf (message "%s" (buffer-string)))))
(sit-for 0)
(condition-case nil
(delete-file f2)
(error nil))))))