help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Calling Ediff which ignores whitespaces from VC Dir


From: Sebastien Vauban
Subject: Re: Calling Ediff which ignores whitespaces from VC Dir
Date: Fri, 02 Aug 2013 11:11:50 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (windows-nt)

Stefan Monnier wrote:
>> Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 2) 0)
>
> 0 is the number of args you have provided.  (1 . 2) is the min and max
> number of args expected by the function.
>
>> With no certainty, I've tried to copy the parameters of `vc-ediff':
>
>> --8<---------------cut here---------------start------------->8---
>>     (defun vc-ediff-ignore-whitespace (historic &optional not-urgent)
>>       "Ignore regions that differ in white space & line breaks only."
>>       (interactive (list current-prefix-arg t))
>>       (let ((ediff-ignore-similar-regions t))
>>         (vc-ediff historic not-urgent)))
>
> You could also use (call-interactively 'vc-ediff) instead.

OK, less error-prone (in case arguments to `vc-ediff' would change).

>>     call-interactively: Symbol's value as variable is void:
>>     ediff-ignore-similar-regions
>
> That's because ediff was (auto)loaded while ediff-ignore-similar-regions
> was let-bound.  So at the end of the let, ediff-ignore-similar-regions
> was reset to its previous value (i.e. unbound).
>
> That's a long standing problem.  To work around such issues, you want to
> explicitly load ediff before doing the let.

When you say "load ediff", I assume you mean writing a `require' call, right?
That way, it's not loaded multiple times?

OK. Latest version, then:

--8<---------------cut here---------------start------------->8---
    (defun vc-ediff-ignore-whitespace (historic &optional not-urgent)
      "Ignore regions that differ in white space & line breaks only."
      (interactive (list current-prefix-arg t))
      (require 'ediff)
      (let ((ediff-ignore-similar-regions t))
        (call-interactively 'vc-ediff)))
--8<---------------cut here---------------end--------------->8---

Though there is no error anymore, it does not work: "similar regions" are not
skipped as expected.

Something due to the fact that the variable `ediff-ignore-similar-regions' is
a local one? When checking its value in the Ediff control window, I see it's
nil -- which confirms the fact that the `let' is somehow not "applied"
correctly.

Is there a way to work around this?

Best regards,
  Seb

-- 
Sebastien Vauban


reply via email to

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