emacs-diffs
[Top][All Lists]
Advanced

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

master 565514f: * lisp/vc/diff-mode.el (diff-setup-buffer-type): Move to


From: Juri Linkov
Subject: master 565514f: * lisp/vc/diff-mode.el (diff-setup-buffer-type): Move to diff-setup-whitespace
Date: Tue, 9 Nov 2021 03:19:03 -0500 (EST)

branch: master
commit 565514fe96a575ceda2db229ac2dc7a78c2f9abd
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/vc/diff-mode.el (diff-setup-buffer-type): Move to 
diff-setup-whitespace
    
    * lisp/vc/vc.el: Add declare-function for diff-setup-buffer-type 
(bug#51016).
---
 lisp/vc/diff-mode.el | 30 +++++++++++++++---------------
 lisp/vc/vc.el        |  3 ++-
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 9bac3aa..e68aa22 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1475,21 +1475,6 @@ See `after-change-functions' for the meaning of BEG, END 
and LEN."
     ;; Added when diff--font-lock-prettify is non-nil!
     (cl-pushnew 'display font-lock-extra-managed-props)))
 
-(defun diff-setup-buffer-type ()
-  "Try to guess the `diff-buffer-type' from content of current Diff mode 
buffer.
-`outline-regexp' is updated accordingly."
-  (save-excursion
-    (goto-char (point-min))
-    (setq-local diff-buffer-type
-                (if (re-search-forward "^diff --git" nil t)
-                    'git
-                  nil)))
-  (when (eq diff-buffer-type 'git)
-    (setq diff-outline-regexp
-          (concat "\\(^diff --git.*\n\\|" diff-hunk-header-re "\\)"))
-    (setq-local outline-level #'diff--outline-level))
-  (setq-local outline-regexp diff-outline-regexp))
-
 (defvar whitespace-style)
 (defvar whitespace-trailing-regexp)
 
@@ -1591,6 +1576,21 @@ modified lines of the diff."
                     "^[-+!] .*?\\([\t ]+\\)$"
                   "^[-+!<>].*?\\([\t ]+\\)$"))))
 
+(defun diff-setup-buffer-type ()
+  "Try to guess the `diff-buffer-type' from content of current Diff mode 
buffer.
+`outline-regexp' is updated accordingly."
+  (save-excursion
+    (goto-char (point-min))
+    (setq-local diff-buffer-type
+                (if (re-search-forward "^diff --git" nil t)
+                    'git
+                  nil)))
+  (when (eq diff-buffer-type 'git)
+    (setq diff-outline-regexp
+          (concat "\\(^diff --git.*\n\\|" diff-hunk-header-re "\\)"))
+    (setq-local outline-level #'diff--outline-level))
+  (setq-local outline-regexp diff-outline-regexp))
+
 (defun diff-delete-if-empty ()
   ;; An empty diff file means there's no more diffs to integrate, so we
   ;; can just remove the file altogether.  Very handy for .rej files if we
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 87137d8..4b56f1b 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -739,6 +739,7 @@
 (require 'cl-lib)
 
 (declare-function diff-setup-whitespace "diff-mode" ())
+(declare-function diff-setup-buffer-type "diff-mode" ())
 
 (eval-when-compile
   (require 'dired))
@@ -1739,7 +1740,7 @@ to override the value of `vc-diff-switches' and 
`diff-switches'."
               (insert (cdr messages) ".\n")
               (message "%s" (cdr messages))))
        (diff-setup-whitespace)
-        (diff-setup-buffer-type)
+       (diff-setup-buffer-type)
        (goto-char (point-min))
        (when window
          (shrink-window-if-larger-than-buffer window)))



reply via email to

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