From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Automating function with interactive args
Date: Fri, 27 Apr 2012 09:42:15 +0200 [thread overview]
Message-ID: <87r4v939k8.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: slrnjpjcc7.1mm.noemail@us.news.astraweb.com
BDB <noemail@yahoo.com> 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-<value>-internal? What's that?
I basically looked at the implementation of ediff-revision, and in the
end it just calls ediff-<value>-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
next prev parent reply other threads:[~2012-04-27 7:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-26 16:53 Automating function with interactive args BDB
2012-04-26 17:08 ` Tassilo Horn
2012-04-26 17:21 ` Drew Adams
[not found] ` <mailman.105.1335460111.855.help-gnu-emacs@gnu.org>
2012-04-26 20:35 ` BDB
2012-04-27 7:42 ` Tassilo Horn [this message]
[not found] ` <mailman.155.1335512574.855.help-gnu-emacs@gnu.org>
2012-04-27 16:30 ` BDB
2012-04-27 16:43 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r4v939k8.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.