* How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
@ 2003-09-23 20:35 Christian Seberino
2003-09-23 21:10 ` Stefan Monnier
2003-09-23 22:08 ` Kevin Rodgers
0 siblings, 2 replies; 13+ messages in thread
From: Christian Seberino @ 2003-09-23 20:35 UTC (permalink / raw)
I tried wrappers for vc-diff and vc-revert-buffer like the ones below
to automatically
take care of saving the buffer and NOT ask me if I want to save the
buffer.
(defun cs-vc-diff() (interactive)
(vc-diff "yes"))
(defun cs-vc-revert-buffer() (interactive)
(save-buffer)
(vc-revert-buffer "yes"))
These did not work but instead I got an error message about the "wrong
number
of arguments" and other junk.
How fix?
any help would be greatly appreaciated
Chris
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-09-23 20:35 How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically? Christian Seberino
@ 2003-09-23 21:10 ` Stefan Monnier
2003-09-23 22:08 ` Kevin Rodgers
1 sibling, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2003-09-23 21:10 UTC (permalink / raw)
> I tried wrappers for vc-diff and vc-revert-buffer like the ones below
> to automatically
> take care of saving the buffer and NOT ask me if I want to save the
> buffer.
How 'bout
C-u C-x s C-x v =
and
C-u C-x s C-x v u
??
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-09-23 20:35 How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically? Christian Seberino
2003-09-23 21:10 ` Stefan Monnier
@ 2003-09-23 22:08 ` Kevin Rodgers
2003-09-24 23:50 ` Christian Seberino
2003-09-25 23:32 ` Christian Seberino
1 sibling, 2 replies; 13+ messages in thread
From: Kevin Rodgers @ 2003-09-23 22:08 UTC (permalink / raw)
Christian Seberino wrote:
> (defun cs-vc-diff() (interactive)
> (vc-diff "yes"))
>
> (defun cs-vc-revert-buffer() (interactive)
> (save-buffer)
> (vc-revert-buffer "yes"))
>
> These did not work but instead I got an error message about the "wrong
> number of arguments" and other junk.
>
> How fix?
(let ((unread-command-events '(?y ?e ?s)))
(vc-foo)) ; (call-interactively 'vc-foo)?
> any help would be greatly appreaciated
Type `C-h f'.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-09-23 22:08 ` Kevin Rodgers
@ 2003-09-24 23:50 ` Christian Seberino
2003-09-25 15:27 ` Kevin Rodgers
2003-09-25 23:32 ` Christian Seberino
1 sibling, 1 reply; 13+ messages in thread
From: Christian Seberino @ 2003-09-24 23:50 UTC (permalink / raw)
Kevin
I am very grateful for your help. Is there a method that will
work to auto-answer any functions question??
You mentioned before that I had to look at the source to determine
what arguments a function would accept....
Some functions are ok with (foo "yes")
while others apparently need something like your snippet here:
(let ((unread-command-events '(?y ?e ?s)))
(vc-foo)) ; (call-interactively 'vc-foo)?
Is there no method that I can learn that will work for all???
Chris
Kevin Rodgers <ihs_4664@yahoo.com> wrote in message news:<3F70C451.6040603@yahoo.com>...
> Christian Seberino wrote:
>
> > (defun cs-vc-diff() (interactive)
> > (vc-diff "yes"))
> >
> > (defun cs-vc-revert-buffer() (interactive)
> > (save-buffer)
> > (vc-revert-buffer "yes"))
> >
> > These did not work but instead I got an error message about the "wrong
> > number of arguments" and other junk.
> >
> > How fix?
>
>
> (let ((unread-command-events '(?y ?e ?s)))
> (vc-foo)) ; (call-interactively 'vc-foo)?
>
>
> > any help would be greatly appreaciated
>
> Type `C-h f'.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-09-24 23:50 ` Christian Seberino
@ 2003-09-25 15:27 ` Kevin Rodgers
0 siblings, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2003-09-25 15:27 UTC (permalink / raw)
Christian Seberino wrote:
> I am very grateful for your help. Is there a method that will
> work to auto-answer any functions question??
No.
> You mentioned before that I had to look at the source to determine
> what arguments a function would accept....
>
> Some functions are ok with (foo "yes")
> while others apparently need something like your snippet here:
>
> (let ((unread-command-events '(?y ?e ?s)))
> (vc-foo)) ; (call-interactively 'vc-foo)?
Actually, the first thing to do is to read the function's doc string and
argument list, via `C-h f'. Some functions have an argument that
controls whether or not the user is queried, but some don't and so you
would need to read the source to see how the particular question is
asked (via y-or-n-p, yes-or-no-p, or some other function).
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-09-23 22:08 ` Kevin Rodgers
2003-09-24 23:50 ` Christian Seberino
@ 2003-09-25 23:32 ` Christian Seberino
2003-09-26 18:42 ` Kevin Rodgers
1 sibling, 1 reply; 13+ messages in thread
From: Christian Seberino @ 2003-09-25 23:32 UTC (permalink / raw)
I tried to wrap your code into my vc-diff wrapper and got an error message...
(defun cs-vc-diff() (interactive)
(let ((unread-command-events '(?y ?e ?s)))
(vc-diff)) ; (call-interactively 'vc-diff)?
)
Here is the error message...
let: Wrong number of arguments: #[(historic &optional not-urgent)
....etc.
CS
>
> > (defun cs-vc-diff() (interactive)
> > (vc-diff "yes"))
> >
> > (defun cs-vc-revert-buffer() (interactive)
> > (save-buffer)
> > (vc-revert-buffer "yes"))
> >
> > These did not work but instead I got an error message about the "wrong
> > number of arguments" and other junk.
> >
> > How fix?
>
>
> (let ((unread-command-events '(?y ?e ?s)))
> (vc-foo)) ; (call-interactively 'vc-foo)?
>
>
> > any help would be greatly appreaciated
>
> Type `C-h f'.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-09-25 23:32 ` Christian Seberino
@ 2003-09-26 18:42 ` Kevin Rodgers
2003-10-01 0:08 ` Christian Seberino
0 siblings, 1 reply; 13+ messages in thread
From: Kevin Rodgers @ 2003-09-26 18:42 UTC (permalink / raw)
Christian Seberino wrote:
> I tried to wrap your code into my vc-diff wrapper and got an error message...
>
> (defun cs-vc-diff() (interactive)
> (let ((unread-command-events '(?y ?e ?s)))
> (vc-diff)) ; (call-interactively 'vc-diff)?
> )
>
> Here is the error message...
>
> let: Wrong number of arguments: #[(historic &optional not-urgent)
> ....etc.
Why do you refuse to type `C-h f vc-diff'?
| vc-diff is an interactive compiled Lisp function in `vc'.
| (vc-diff HISTORIC &optional NOT-URGENT)
|
| Display diffs between file versions.
| Normally this compares the current file and buffer with the most
| recent checked in version of that file. This uses no arguments. With
| a prefix argument HISTORIC, it reads the file name to use and two
| version designators specifying which versions to compare. The
| optional argument NOT-URGENT non-nil means it is ok to say no to
| saving the buffer.
So you probably want to run (vc-diff nil).
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-09-26 18:42 ` Kevin Rodgers
@ 2003-10-01 0:08 ` Christian Seberino
2003-10-01 0:24 ` Stefan Monnier
2003-10-01 14:58 ` Kevin Rodgers
0 siblings, 2 replies; 13+ messages in thread
From: Christian Seberino @ 2003-10-01 0:08 UTC (permalink / raw)
Kevin
Thanks! With your help I got vc-diff and vc-revert-buffer to NOT ask
me if I want to save buffer because it is now done automatically.
Can I please ask you how to avoid 1 more question in
vc-revert-buffer???
vc-revert-buffer seems to do a vc-diff command and then asks
a SECOND question something like... "Are you *sure* you want
to discard these changes?"
How hardcode answer to this SECOND question to be yes???
I read the emacs online doc on vc-revert-buffer like you suggested
but it had no clues. Here it is:
vc-revert-buffer is an interactive autoloaded Lisp function in `vc'.
It is bound to <menu-bar> <tools> <vc> <vc-revert-buffer>.
(vc-revert-buffer)
Revert the current buffer's file to the version it was based on.
This asks for confirmation if the buffer contents are not identical
to that version. This function does not automatically pick up newer
changes found in the master file; use M-x universal-argument M-x
vc-next-action to do so.
Any help greatly appreciated.
Chris
Kevin Rodgers <ihs_4664@yahoo.com> wrote in message news:<3F748888.7060101@yahoo.com>...
> Christian Seberino wrote:
>
> > I tried to wrap your code into my vc-diff wrapper and got an error message...
> >
> > (defun cs-vc-diff() (interactive)
> > (let ((unread-command-events '(?y ?e ?s)))
> > (vc-diff)) ; (call-interactively 'vc-diff)?
> > )
> >
> > Here is the error message...
> >
> > let: Wrong number of arguments: #[(historic &optional not-urgent)
> > ....etc.
>
> Why do you refuse to type `C-h f vc-diff'?
>
> | vc-diff is an interactive compiled Lisp function in `vc'.
> | (vc-diff HISTORIC &optional NOT-URGENT)
> |
> | Display diffs between file versions.
> | Normally this compares the current file and buffer with the most
> | recent checked in version of that file. This uses no arguments. With
> | a prefix argument HISTORIC, it reads the file name to use and two
> | version designators specifying which versions to compare. The
> | optional argument NOT-URGENT non-nil means it is ok to say no to
> | saving the buffer.
>
> So you probably want to run (vc-diff nil).
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-10-01 0:08 ` Christian Seberino
@ 2003-10-01 0:24 ` Stefan Monnier
2003-10-01 14:58 ` Kevin Rodgers
1 sibling, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2003-10-01 0:24 UTC (permalink / raw)
> Thanks! With your help I got vc-diff and vc-revert-buffer to NOT ask
> me if I want to save buffer because it is now done automatically.
Did my
C-u C-x s C-x v =
suggestion work or (or did it get lost in the ether) ?
> Can I please ask you how to avoid 1 more question in
> vc-revert-buffer???
I don't have a good alternative for that one, but I'd ask you
instead what you're trying to do. It's normally a rare event to
call vc-revert-buffer, so maybe your problem could be solved better
by some other mean that avoids calling vc-revert-buffer.
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-10-01 0:08 ` Christian Seberino
2003-10-01 0:24 ` Stefan Monnier
@ 2003-10-01 14:58 ` Kevin Rodgers
2003-10-03 1:03 ` Christian Seberino
1 sibling, 1 reply; 13+ messages in thread
From: Kevin Rodgers @ 2003-10-01 14:58 UTC (permalink / raw)
[Please don't top-post.]
Christian Seberino wrote:
> Can I please ask you how to avoid 1 more question in
> vc-revert-buffer???
>
> vc-revert-buffer seems to do a vc-diff command and then asks
> a SECOND question something like... "Are you *sure* you want
> to discard these changes?"
>
> How hardcode answer to this SECOND question to be yes???
The same way: by pushing additional characters on to unread-command-events.
> I read the emacs online doc on vc-revert-buffer like you suggested
> but it had no clues. Here it is:
>
> vc-revert-buffer is an interactive autoloaded Lisp function in `vc'.
> It is bound to <menu-bar> <tools> <vc> <vc-revert-buffer>.
> (vc-revert-buffer)
^^^^^^^^^^^^^^^^^^
That tells you that it does not take any arguments.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-10-01 14:58 ` Kevin Rodgers
@ 2003-10-03 1:03 ` Christian Seberino
2003-10-03 8:51 ` Johan Bockgård
0 siblings, 1 reply; 13+ messages in thread
From: Christian Seberino @ 2003-10-03 1:03 UTC (permalink / raw)
Kevin
Indeed the following wrapper for vc-revert-buffer spells out "yes"
when it asks
the last question: "Discard changes? yes or no".
I must still press RETURN to answer the question.
Can I please ask you how to add the RETURN to the "yes" that this
wrapper spells out? Then it will
be done!
(defun cs-vc-revert-buffer() (interactive)
(save-buffer)
(let ((unread-command-events '(?y ?e ?s)))
(vc-revert-buffer)) ; (call-interactively 'vc-revert-buffer)?
)
Chris
P.S. The (save-buffer) is an easy way to avoid the FIRST question
which asks if I want
to save.
Kevin Rodgers <ihs_4664@yahoo.com> wrote in message news:<3F7AEB83.4050500@yahoo.com>...
> [Please don't top-post.]
>
> Christian Seberino wrote:
>
> > Can I please ask you how to avoid 1 more question in
> > vc-revert-buffer???
> >
> > vc-revert-buffer seems to do a vc-diff command and then asks
> > a SECOND question something like... "Are you *sure* you want
> > to discard these changes?"
> >
> > How hardcode answer to this SECOND question to be yes???
>
>
> The same way: by pushing additional characters on to unread-command-events.
>
>
> > I read the emacs online doc on vc-revert-buffer like you suggested
> > but it had no clues. Here it is:
> >
> > vc-revert-buffer is an interactive autoloaded Lisp function in `vc'.
> > It is bound to <menu-bar> <tools> <vc> <vc-revert-buffer>.
> > (vc-revert-buffer)
> ^^^^^^^^^^^^^^^^^^
>
> That tells you that it does not take any arguments.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-10-03 1:03 ` Christian Seberino
@ 2003-10-03 8:51 ` Johan Bockgård
2003-10-06 22:44 ` Christian Seberino
0 siblings, 1 reply; 13+ messages in thread
From: Johan Bockgård @ 2003-10-03 8:51 UTC (permalink / raw)
seberino@spawar.navy.mil (Christian Seberino) writes:
> Indeed the following wrapper for vc-revert-buffer spells out "yes"
> when it asks the last question: "Discard changes? yes or no".
>
> I must still press RETURN to answer the question.
>
> Can I please ask you how to add the RETURN to the "yes" that this
> wrapper spells out? Then it will be done!
>
> (defun cs-vc-revert-buffer() (interactive)
> (save-buffer)
> (let ((unread-command-events '(?y ?e ?s)))
> (vc-revert-buffer)) ; (call-interactively 'vc-revert-buffer)?
> )
Does (unread-command-events '(?y ?e ?s ?\C-m)) work?
--
Johan Bockgård
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically?
2003-10-03 8:51 ` Johan Bockgård
@ 2003-10-06 22:44 ` Christian Seberino
0 siblings, 0 replies; 13+ messages in thread
From: Christian Seberino @ 2003-10-06 22:44 UTC (permalink / raw)
Johan
Thanks. This was a real gift. You helped me more than you know.
Chris
bojohan+news@dd.chalmers.se (Johan Bockgård) wrote in message news:<yoijsmmawvou.fsf@samwise.dd.chalmers.se>...
> seberino@spawar.navy.mil (Christian Seberino) writes:
>
> > Indeed the following wrapper for vc-revert-buffer spells out "yes"
> > when it asks the last question: "Discard changes? yes or no".
> >
> > I must still press RETURN to answer the question.
> >
> > Can I please ask you how to add the RETURN to the "yes" that this
> > wrapper spells out? Then it will be done!
> >
> > (defun cs-vc-revert-buffer() (interactive)
> > (save-buffer)
> > (let ((unread-command-events '(?y ?e ?s)))
> > (vc-revert-buffer)) ; (call-interactively 'vc-revert-buffer)?
> > )
>
> Does (unread-command-events '(?y ?e ?s ?\C-m)) work?
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2003-10-06 22:44 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-23 20:35 How make vc-diff and vc-revert-buffer NOT ask to save files but do it automatically? Christian Seberino
2003-09-23 21:10 ` Stefan Monnier
2003-09-23 22:08 ` Kevin Rodgers
2003-09-24 23:50 ` Christian Seberino
2003-09-25 15:27 ` Kevin Rodgers
2003-09-25 23:32 ` Christian Seberino
2003-09-26 18:42 ` Kevin Rodgers
2003-10-01 0:08 ` Christian Seberino
2003-10-01 0:24 ` Stefan Monnier
2003-10-01 14:58 ` Kevin Rodgers
2003-10-03 1:03 ` Christian Seberino
2003-10-03 8:51 ` Johan Bockgård
2003-10-06 22:44 ` Christian Seberino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).