[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Local values of PC-word-delimiters.
From: |
Michaël Cadilhac |
Subject: |
Re: Local values of PC-word-delimiters. |
Date: |
Tue, 18 Apr 2006 12:05:01 +0200 |
User-agent: |
Gnus/5.110005 (No Gnus v0.5) Emacs/22.0.50 (gnu/linux) |
michael.cadilhac@lrde.org (Michaël Cadilhac) writes:
> Kevin Rodgers <ihs_4664@yahoo.com> writes:
>
>> Michaël Cadilhac wrote:
>>> I've a problem I can't solve in a clean way, here.
>>>
>>> I want that when `gnus-group-jump-to-group' is called, its
>>> completing-read (PC enabled) uses `:' as PC-word-delimiters.
>>>
>>
>> Does this work?
>>
>> (defadvice gnus-group-jump-to-group (before PC-word-delimiters activate)
>> "Temporarily bind `PC-word-delimiters' while reading GROUP."
>> (interactive
>> (let ((PC-word-delimiters ":"))
>> (call-interactively
>> `(lambda (&rest args)
>> ,(interactive-form 'gnus-group-jump-to-group)
>> args)))))
>
> Nice try :-)
>
> Well, it doesn't. It complains about infinite recursion. I think it's
> due to infinite evaluation of the advice on the « interactive-form ».
>
> However, with a « before » advice, I think jump-to-group would have
> been called twice.
Okey, this remark was silly, I didn't read as I should your
proposition, TITS with a lot of attention ;-)
The following doesn't work:
> (defadvice gnus-group-jump-to-group (around PC-word-delimiters activate)
> "Temporarily bind `PC-word-delimiters' while reading GROUP."
> (interactive
> (let ((PC-word-delimiters ":"))
> (ad-deactivate 'gnus-group-jump-to-group)
> (call-interactively 'gnus-group-jump-to-group)
> (ad-activate 'gnus-group-jump-to-group))))
And is really dirty.
One can fix your proposal, which is a really great one, by the
following :
(defadvice gnus-group-jump-to-group (before PC-word-delimiters activate)
"Temporarily bind `PC-word-delimiters' while reading GROUP."
(interactive
(progn (ad-deactivate 'gnus-group-jump-to-group)
(let* ((PC-word-delimiters ":")
(retval (call-interactively
`(lambda (&rest args)
,(interactive-form 'gnus-group-jump-to-group)
args))))
(ad-activate 'gnus-group-jump-to-group)
retval))))
Thank you again, now it seems fine !
--
| Michaël `Micha' Cadilhac | Pour les 35-40 ans, l'humour |
| Epita/LRDE Promo 2007 | c'est une plus-value. |
| http://www.lrde.org/~cadilh_m | -- Guillaume L. |
`-- - JID: micha@amessage.be --' - --'
pgpiajC1oH8dy.pgp
Description: PGP signature