emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a5e8da4fa2: Add new user option `diff-entire-buffers'


From: Lars Ingebrigtsen
Subject: master a5e8da4fa2: Add new user option `diff-entire-buffers'
Date: Mon, 21 Mar 2022 14:28:31 -0400 (EDT)

branch: master
commit a5e8da4fa28a233f3c1dee25a31072df7db6cf61
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/vc/diff.el | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 4abcf6c15a..926993eebb 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
@@ -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)))
 
@@ -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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]