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: Andreas Politz
Subject: Re: repeat-complex-command too complex
Date: Wed, 08 Dec 2010 15:33:40 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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)))))

-ap


reply via email to

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