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 XEmacs, 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" (buffer-name b2))
(with-temp-buffer "*Verilog-Diff*"
(let ((outbuf (current-buffer))
(f2 (make-temp-file "vm-diff-auto-")))
(unwind-protect
(progn
(with-current-buffer b2
(save-restriction
(widen)
(write-region (point-min) (point-max) f2 nil 'nomessage)))
(call-process diff-command nil outbuf t
diff-switches ; User may want -u in diff-switches
(if whitespace "-b" "")
f1 f2)
;; 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)
(when (file-exists-p f2)
(delete-file f2))))))