summaryrefslogtreecommitdiff
path: root/lisp/vc/diff.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/vc/diff.el')
-rw-r--r--lisp/vc/diff.el24
1 files changed, 17 insertions, 7 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 341a2891265..3e35a3329b1 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -52,6 +52,12 @@ set (`vc-git-diff-switches' for git, for instance), and
"The command to use to run diff."
:type 'string)
+(defcustom diff-entire-buffers t
+ "If non-nil, diff the entire buffers, not just the visible part.
+If nil, only use the narrowed-to parts of the buffers."
+ :type 'boolean
+ :version "29.1")
+
;; prompt if prefix arg present
(defun diff-switches ()
(if current-prefix-arg
@@ -96,15 +102,15 @@ Non-interactively, OLD and NEW may each be a file or a buffer."
(interactive
(let* ((newf (if (and buffer-file-name (file-exists-p buffer-file-name))
(read-file-name
- (concat "Diff new file (default "
- (file-name-nondirectory buffer-file-name) "): ")
+ (format-prompt "Diff new file"
+ (file-name-nondirectory buffer-file-name))
nil buffer-file-name t)
(read-file-name "Diff new file: " nil nil t)))
(oldf (file-newest-backup newf)))
(setq oldf (if (and oldf (file-exists-p oldf))
(read-file-name
- (concat "Diff original file (default "
- (file-name-nondirectory oldf) "): ")
+ (format-prompt "Diff original file"
+ (file-name-nondirectory oldf))
(file-name-directory oldf) oldf t)
(read-file-name "Diff original file: "
(file-name-directory newf) nil t)))
@@ -119,7 +125,9 @@ temporary file with the buffer's contents."
(if (bufferp file-or-buf)
(with-current-buffer file-or-buf
(let ((tempfile (make-temp-file "buffer-content-")))
- (write-region nil nil tempfile nil 'nomessage)
+ (if diff-entire-buffers
+ (write-region nil nil tempfile nil 'nomessage)
+ (write-region (point-min) (point-max) tempfile nil 'nomessage))
tempfile))
(file-local-copy file-or-buf)))
@@ -145,7 +153,7 @@ Possible values are:
;; Noninteractive helper for creating and reverting diff buffers
"Compare the OLD and NEW file/buffer.
If the optional SWITCHES is nil, the switches specified in the
-variable ‘diff-switches’ are passed to the diff command,
+variable `diff-switches' are passed to the diff command,
otherwise SWITCHES is used. SWITCHES can be a string or a list
of strings.
@@ -274,7 +282,9 @@ interactively for diff switches. Otherwise, the switches
specified in the variable `diff-switches' are passed to the
diff command.
-OLD and NEW may each be a buffer or a buffer name."
+OLD and NEW may each be a buffer or a buffer name.
+
+Also see the `diff-entire-buffers' variable."
(interactive
(let ((newb (read-buffer "Diff new buffer" (current-buffer) t))
(oldb (read-buffer "Diff original buffer"