branch: externals/vdiff commit 872de4d5aaf61d62bbe54833f987bb85eeef12e1 Author: wwade <ww...@users.noreply.github.com> Commit: wwade <ww...@users.noreply.github.com>
Fix diff opts handling (ignore case / whitespace) Inside `vdiff-refresh`, when append is used to build up the diff command, if one of the intermediate args to append is a string and not a list, append will expand it into the string's character values. So, "-w" becomes 45 119, and this `Wrong type argument: stringp, 45` error message is shown. Added a small helper that converts non-empty strings using `ensure-list` to avoid this problem. We only want non-empty strings, though, otherwise an empty diff opt would get added as an explicit empty string arg which would cause diff to fail, e.g. diff -w "" -- file1 file2 Where we actually want: diff -w -- file1 file2 Fixes: #36 --- vdiff.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vdiff.el b/vdiff.el index ac07e9c36b..092731d623 100644 --- a/vdiff.el +++ b/vdiff.el @@ -506,6 +506,11 @@ non-nil. Ignore folds if NO-FOLD is non-nil." (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) @@ -524,9 +529,9 @@ POST-REFRESH-FUNCTION is called when the process finishes." (ses vdiff--session) (cmd (append base-cmd - (vdiff-session-whitespace-args ses) + (vdiff--nonempty-str-to-list (vdiff-session-whitespace-args ses)) (unless (string= (car base-cmd) "git") - (vdiff-session-case-args ses)) + (vdiff--nonempty-str-to-list (vdiff-session-case-args ses))) (list "--" tmp-a tmp-b) (when tmp-c (list tmp-c))))