[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defadvice question.
From: |
Kevin Rodgers |
Subject: |
Re: defadvice question. |
Date: |
Tue, 22 Sep 2009 20:21:36 -0600 |
User-agent: |
Thunderbird 2.0.0.23 (Macintosh/20090812) |
Michal wrote:
Hallo Kevin.
Thank You very much for the answer.
Unfortunately I have problems with both solutions.
Did You check if it works on YOur site, or this is rather Your suggestion?
I actually tested this suggestion.
Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
(defadvice cvs-checkout (before minibuffer-history)
"Add CVSROOT environment variable to `minibuffer-history'."
(interactive (let ((minibuffer-history
(cons (getenv "CVSROOT") minibuffer-history)))
...)))
The tricky part is the "...". You could copy the entire interactive form from
cvs-checkout source in pcvs.el, but that defeats the whole purpose of using
advice. You might be able to work around it like this:
I C-u M-x cvs-checkout
call-interactively: Symbol's value as variable is void: \.\.\.
... was not meant to be evaluated literally. Also, I did not attempt to handle
a prefix argument -- to do that, just add this binding to the let form:
(prefix-arg current-prefix-arg)
(defvar cvs-checkout-interactive-form
(interactive-form 'cvs-checkout))
(defadvice cvs-checkout (before minibuffer-history)
"Add CVSROOT environment variable to `minibuffer-history'."
(interactive (let ((minibuffer-history
(cons (getenv "CVSROOT") minibuffer-history)))
(call-interactively `(lambda (&rest cvs-checkout-args)
,cvs-checkout-interactive-form
cvs-checkout-args)))))
While this does not produce any error message, but my cvs root is not
put to minibuffer history.
What does M-: (getenv "CVSROOT") display?
cvs-checkout reads several arguments interactively, with different functions
that use different history variables. Which prompt are you interested in,
"CVS Root: ", "Module(s): ", or "CVS Checkout Directory: "?
--
Kevin Rodgers
Denver, Colorado, USA