From 4990598e2ca81efe8086c77e89324736c9fd3a61 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 26 Oct 2007 08:07:17 +0000 Subject: [PATCH] 2007-10-26 John Wiegley * eshell/em-unix.el (eshell/diff): Before calling the `diff' function, ensure that the third argument is turned into a NIL if the string is otherwise completely empty (either no characters, or all tabs/spaces). This fixes a bug from a user who found himself unable to customize `diff-switches' and still use Eshell's diff command. --- lisp/ChangeLog | 9 +++++++++ lisp/eshell/em-unix.el | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 17c3e0af8c9..aa8f1460ce1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2007-10-26 John Wiegley + + * eshell/em-unix.el (eshell/diff): Before calling the `diff' + function, ensure that the third argument is turned into a NIL if + the string is otherwise completely empty (either no characters, or + all tabs/spaces). This fixes a bug from a user who found himself + unable to customize `diff-switches' and still use Eshell's diff + command. + 2007-10-26 Glenn Morris * emacs-lisp/bytecomp.el (byte-compile-warnings): Autoload the diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 850d51dcac5..384fa083947 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -974,6 +974,13 @@ Show wall-clock time elapsed during execution of COMMAND.") (if eshell-diff-window-config (set-window-configuration eshell-diff-window-config))) +(defun nil-blank-string ( string ) + "if a string is all blanks return nil, if there are non-blank characters +return the string" + (cond + ((string-match "[^[:blank:]]" string ) string) + (nil))) + (defun eshell/diff (&rest args) "Alias \"diff\" to call Emacs `diff' function." (let ((orig-args (eshell-stringify-list (eshell-flatten-list args)))) @@ -995,7 +1002,8 @@ Show wall-clock time elapsed during execution of COMMAND.") (setcdr (last args 3) nil)) (with-current-buffer (condition-case err - (diff old new (eshell-flatten-and-stringify args)) + (diff old new + (nil-blank-string (eshell-flatten-and-stringify args))) (error (throw 'eshell-replace-command (eshell-parse-command "*diff" orig-args)))) -- 2.39.2