help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: repeat-complex-command too complex


From: despen
Subject: Re: repeat-complex-command too complex
Date: Wed, 08 Dec 2010 15:33:42 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Andreas Politz <politza@fh-trier.de> writes:

> despen@verizon.net writes:
>
>> Barry Margolin <barmar@alum.mit.edu> writes:
>>
>>> In article <icmxq1m3cc.fsf@verizon.net>, despen@verizon.net wrote:
>>>
>>>> It's pretty unfortunate.  I actually have repeat-complex-command
>>>> bound to a key and use it a lot.  Plus I never use transient mark
>>>> mode.  It's too visually disturbing.
>>>> 
>>>> Thanks.
>>>
>>> (defun my-query-replace (from-string to-string)
>>>   (interactive "sReplace: \nsWith: ")
>>>   (query-replace from-string to-string))
>>>
>>> Then bind M-% to my-query-replace.
>>
>> Have to admit, I tried to do that myself and failed.
>> My understanding of "interactive" is sadly lacking.
>> I think I have it now though.
>>
>> Thanks!
>
> Changing the interactive spec with an advice is also an option.
>
> (defadvice query-replace (before hack-interactive-spec activate)
>   (interactive
>    (let ((common
>         (query-replace-read-args
>          (concat "Replace"
>                  (if current-prefix-arg " word" "")
>                  " string")
>          nil)))
>      (list (nth 0 common) (nth 1 common) (nth 2 common)))))

Elegant, but it looks like it might not stand up to working
for years in my .emacs file.

Thanks though.  Caused me to look in replace.el to try to
understand it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]