From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sebastien Vauban" Newsgroups: gmane.emacs.help Subject: Re: Calling Ediff which ignores whitespaces from VC Dir Date: Fri, 02 Aug 2013 11:11:50 +0200 Organization: Sebastien Vauban Message-ID: <86txj8jw2x.fsf@somewhere.org> References: <8661vph4dl.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1375434929 30860 80.91.229.3 (2 Aug 2013 09:15:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Aug 2013 09:15:29 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Fri Aug 02 11:15:31 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V5BSK-0004AY-Oy for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Aug 2013 11:15:28 +0200 Original-Received: from localhost ([::1]:56998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5BSK-0000vB-8W for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Aug 2013 05:15:28 -0400 Original-Path: usenet.stanford.edu!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Injection-Info: mx05.eternal-september.org; posting-host="402b34550bd938aa98825778083dce0e"; logging-data="18294"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX1+DachhKPfB9ToIzeWwIVym" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:RKWZzNEAsw96jFc5hBeHtjGiUxQ= sha1:AuPZWtJYd+5ioDfD/80ueEA1Mso= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:200393 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:92660 Archived-At: 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