emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 3bfb5de 32/57: Truncate long lines by default


From: Justin Burkett
Subject: [elpa] master 3bfb5de 32/57: Truncate long lines by default
Date: Tue, 3 Nov 2020 14:32:22 -0500 (EST)

branch: master
commit 3bfb5decd7fcef73759b247b29aeae669fb79499
Author: Justin Burkett <justin@burkett.cc>
Commit: Justin Burkett <justin@burkett.cc>

    Truncate long lines by default
    
    Adds vdiff-truncate-lines to control the behavior.
    
    Fixes #21
---
 vdiff.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 84ad0b4..4ac2bc0 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -73,6 +73,10 @@
 `vdiff-mode'."
   :type 'boolean)
 
+(defcustom vdiff-truncate-lines t
+  "If non-nil, use `toggle-truncate-lines' in vdiff buffers."
+  :type 'boolean)
+
 (defcustom vdiff-diff-algorithms
   '((diff . "diff -u")
     (diff-minimal . "diff -u --minimal")
@@ -2184,7 +2188,12 @@ See README for entry points into a vdiff session."))
     (add-hook 'after-change-functions #'vdiff--after-change-function nil t)
     (add-hook 'pre-command-hook #'vdiff--flag-new-command nil t)
     (setf (vdiff-session-window-config vdiff--session)
-          (current-window-configuration))))
+          (current-window-configuration))
+    (when vdiff-lock-scrolling
+      (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t))
+    (when vdiff-truncate-lines
+      (let (message-log-max)
+        (toggle-truncate-lines 1)))))
 
 (defun vdiff--buffer-cleanup ()
   (vdiff--remove-all-overlays)
@@ -2202,13 +2211,9 @@ hooks to refresh diff on changes. This will be enabled
 automatically after calling commands like `vdiff-files' or
 `vdiff-buffers'."
   nil " vdiff" 'vdiff-mode-map
-  (cond (vdiff-mode
-         (vdiff--buffer-init)
-         (when (and (not vdiff--testing-mode)
-                    vdiff-lock-scrolling)
-          (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t)))
-        (t
-         (vdiff--buffer-cleanup))))
+  (if vdiff-mode
+      (vdiff--buffer-init)
+    (vdiff--buffer-cleanup)))
 
 (define-minor-mode vdiff-3way-mode
   "Minor mode active in a vdiff session involving three
@@ -2217,13 +2222,9 @@ adds hooks to refresh diff on changes. This will be 
enabled
 automatically after calling commands like `vdiff-files3' or
 `vdiff-buffers3'."
   nil " vdiff3" 'vdiff-3way-mode-map
-  (cond (vdiff-3way-mode
-         (vdiff--buffer-init)
-         (when (and (not vdiff--testing-mode)
-                    vdiff-lock-scrolling)
-           (add-hook 'window-scroll-functions #'vdiff--scroll-function nil t)))
-        (t
-         (vdiff--buffer-cleanup))))
+  (if vdiff-3way-mode
+      (vdiff--buffer-init)
+    (vdiff--buffer-cleanup)))
 
 (define-minor-mode vdiff-scroll-lock-mode
   "Lock scrolling between vdiff buffers. This minor mode will be



reply via email to

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