diff options
| author | Lars Ingebrigtsen | 2022-03-21 19:28:14 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-03-21 19:28:14 +0100 |
| commit | a5e8da4fa28a233f3c1dee25a31072df7db6cf61 (patch) | |
| tree | e7792a3d8accaf28b892314529c35d28a99637fa | |
| parent | fd5fe11211a469c42fb7142f5a26f577e8ff0010 (diff) | |
| download | emacs-a5e8da4fa28a233f3c1dee25a31072df7db6cf61.tar.gz emacs-a5e8da4fa28a233f3c1dee25a31072df7db6cf61.zip | |
Add new user option `diff-entire-buffers'
* lisp/vc/diff.el (diff-entire-buffers): New user option (bug#54060).
(diff-file-local-copy): Use it.
(diff-buffers): Mention it in the doc string.
| -rw-r--r-- | lisp/vc/diff.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 4abcf6c15a7..926993eebb7 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 | |||
| 52 | "The command to use to run diff." | 52 | "The command to use to run diff." |
| 53 | :type 'string) | 53 | :type 'string) |
| 54 | 54 | ||
| 55 | (defcustom diff-entire-buffers t | ||
| 56 | "If non-nil, diff the entire buffers, not just the visible part. | ||
| 57 | If nil, only use the narrowed-to parts of the buffers." | ||
| 58 | :type 'boolean | ||
| 59 | :version "29.1") | ||
| 60 | |||
| 55 | ;; prompt if prefix arg present | 61 | ;; prompt if prefix arg present |
| 56 | (defun diff-switches () | 62 | (defun diff-switches () |
| 57 | (if current-prefix-arg | 63 | (if current-prefix-arg |
| @@ -119,7 +125,9 @@ temporary file with the buffer's contents." | |||
| 119 | (if (bufferp file-or-buf) | 125 | (if (bufferp file-or-buf) |
| 120 | (with-current-buffer file-or-buf | 126 | (with-current-buffer file-or-buf |
| 121 | (let ((tempfile (make-temp-file "buffer-content-"))) | 127 | (let ((tempfile (make-temp-file "buffer-content-"))) |
| 122 | (write-region nil nil tempfile nil 'nomessage) | 128 | (if diff-entire-buffers |
| 129 | (write-region nil nil tempfile nil 'nomessage) | ||
| 130 | (write-region (point-min) (point-max) tempfile nil 'nomessage)) | ||
| 123 | tempfile)) | 131 | tempfile)) |
| 124 | (file-local-copy file-or-buf))) | 132 | (file-local-copy file-or-buf))) |
| 125 | 133 | ||
| @@ -274,7 +282,9 @@ interactively for diff switches. Otherwise, the switches | |||
| 274 | specified in the variable `diff-switches' are passed to the | 282 | specified in the variable `diff-switches' are passed to the |
| 275 | diff command. | 283 | diff command. |
| 276 | 284 | ||
| 277 | OLD and NEW may each be a buffer or a buffer name." | 285 | OLD and NEW may each be a buffer or a buffer name. |
| 286 | |||
| 287 | Also see the `diff-entire-buffers' variable." | ||
| 278 | (interactive | 288 | (interactive |
| 279 | (let ((newb (read-buffer "Diff new buffer" (current-buffer) t)) | 289 | (let ((newb (read-buffer "Diff new buffer" (current-buffer) t)) |
| 280 | (oldb (read-buffer "Diff original buffer" | 290 | (oldb (read-buffer "Diff original buffer" |