From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Automating function with interactive args Date: Fri, 27 Apr 2012 09:42:15 +0200 Message-ID: <87r4v939k8.fsf@thinkpad.tsdh.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1335512581 12319 80.91.229.3 (27 Apr 2012 07:43:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2012 07:43:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 27 09:43:00 2012 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 1SNfpT-0004jR-QT for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2012 09:42:59 +0200 Original-Received: from localhost ([::1]:42474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNfpT-0007jN-6R for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2012 03:42:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNfpF-0007iw-Jp for help-gnu-emacs@gnu.org; Fri, 27 Apr 2012 03:42:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SNfp9-0007mh-Cz for help-gnu-emacs@gnu.org; Fri, 27 Apr 2012 03:42:45 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:33161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNfp8-0007mL-Sj for help-gnu-emacs@gnu.org; Fri, 27 Apr 2012 03:42:39 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SNfp7-0004Kt-1U for help-gnu-emacs@gnu.org; Fri, 27 Apr 2012 09:42:37 +0200 Original-Received: from tsdh.uni-koblenz.de ([141.26.67.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Apr 2012 09:42:37 +0200 Original-Received: from tassilo by tsdh.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Apr 2012 09:42:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: tsdh.uni-koblenz.de User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.1.50 (gnu/linux) Cancel-Lock: sha1:x+eD2ZYmygYsG8sH5nSnqay65U4= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.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@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84660 Archived-At: BDB writes: > Tassilo Horn wrote: >> --8<---------------cut here---------------start------------->8--- >> (require 'ediff) >> >> (defun my-ediff-revision-latest () >> (interactive) >> (ediff-load-version-control) >> (funcall >> (intern (format "ediff-%S-internal" ediff-version-control-package)) >> nil nil nil)) >> --8<---------------cut here---------------end--------------->8--- > > This didn't work, however it seemed close (closer than the other > example posted). It brought up ediff with both windows pointing to > the same HEAD version of the file, and gave an error "Removing old > name: no such file or directory ..." Hm... > Anyone willing to help me understand the code here? The format > command is kind of like sprintf, right? Yes. > Why are you trying to call ediff--internal? What's that? I basically looked at the implementation of ediff-revision, and in the end it just calls ediff--internal where value is usually vc. I think the problem was that I provided nil for the files but they should be "" for the defaults. This one seems to work, and I also query to save the buffer now like Drew. --8<---------------cut here---------------start------------->8--- (defun my-ediff-revision-latest () (interactive) (if (and (buffer-modified-p) (y-or-n-p (format "Buffer %s is modified. Save buffer? " (buffer-name)))) (save-buffer (current-buffer))) (ediff-load-version-control) (funcall (intern (format "ediff-%S-internal" ediff-version-control-package)) "" "" nil)) --8<---------------cut here---------------end--------------->8--- Bye, Tassilo