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

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

[elpa] externals/vdiff ddc9d92f97 2/4: make vdiff-session-whitespace-arg


From: ELPA Syncer
Subject: [elpa] externals/vdiff ddc9d92f97 2/4: make vdiff-session-whitespace-args a list everywhere
Date: Wed, 21 Jun 2023 01:00:51 -0400 (EDT)

branch: externals/vdiff
commit ddc9d92f974374878376261e4a0b2390a321c8dd
Author: wwade <wwade@users.noreply.github.com>
Commit: wwade <wwade@users.noreply.github.com>

    make vdiff-session-whitespace-args a list everywhere
    
    @justbur suggested making vdiff-session-whitespace-args a list
    everywhere instead of converting it to a list when it is being used.
    
    I also changed vdiff-session-case-args in the same way.
---
 vdiff.el | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 092731d623..f80ec82d7e 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -296,6 +296,10 @@ because those are handled differently.")
   "Make ARGS into list and remove nils."
   (delq nil (apply #'list args)))
 
+(defun vdiff--maybe-list (str)
+  "Return a list with STR as the sole element, or an empty list."
+  (if (string= str "") '() (list str)))
+
 (defun vdiff--buffer-a-p ()
   (when (and
          vdiff--session
@@ -489,7 +493,7 @@ non-nil. Ignore folds if NO-FOLD is non-nil."
                             vdiff--case-options)
            vdiff--case-options))))
   (setf (vdiff-session-case-args vdiff--session)
-        command-line-arg)
+        (vdiff--maybe-list command-line-arg))
   (when vdiff-mode
     (vdiff-refresh)))
 
@@ -502,15 +506,10 @@ non-nil. Ignore folds if NO-FOLD is non-nil."
                             vdiff--whitespace-options)
            vdiff--whitespace-options))))
   (setf (vdiff-session-whitespace-args vdiff--session)
-        command-line-arg)
+        (vdiff--maybe-list command-line-arg))
   (when vdiff-mode
     (vdiff-refresh)))
 
-(defun vdiff--nonempty-str-to-list (str)
-  "Return a list for a non-empty `STR' or else nil."
-  (unless (string-empty-p str)
-    (ensure-list str)))
-
 ;; * Main overlay refresh routine
 
 (defun vdiff-refresh (&optional post-refresh-function)
@@ -529,9 +528,9 @@ POST-REFRESH-FUNCTION is called when the process finishes."
            (ses vdiff--session)
            (cmd (append
                  base-cmd
-                 (vdiff--nonempty-str-to-list (vdiff-session-whitespace-args 
ses))
+                 (vdiff-session-whitespace-args ses)
                  (unless (string= (car base-cmd) "git")
-                   (vdiff--nonempty-str-to-list (vdiff-session-case-args ses)))
+                   (vdiff-session-case-args ses))
                  (list "--" tmp-a tmp-b)
                  (when tmp-c
                    (list tmp-c))))
@@ -1906,8 +1905,8 @@ with non-nil USE-FOLDS."
    :process-buffer (generate-new-buffer-name " *vdiff* ")
    :word-diff-output-buffer (generate-new-buffer-name " *vdiff-word* ")
    :folds (make-hash-table :test 'equal :weakness 'value)
-   :case-args ""
-   :whitespace-args ""
+   :case-args nil
+   :whitespace-args nil
    :prior-window-config prior-window-config
    :on-quit on-quit
    :kill-buffers-on-quit kill-buffers-on-quit))
@@ -2364,7 +2363,7 @@ enabled automatically if `vdiff-lock-scrolling' is 
non-nil."
     "on (-i)"))
 
 (defun vdiff--current-whitespace ()
-  (pcase (vdiff-session-whitespace-args vdiff--session)
+  (pcase (car (vdiff-session-whitespace-args vdiff--session))
     ("" "off")
     ("-w" "all (-w)")
     ("-b" "space changes (-b)")



reply via email to

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