unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* repeat-complex-command too complex
@ 2010-10-26  0:40 despen
       [not found] ` <barmar-12C417.00343426102010@reserved-multicast-range-not-delegated.example.com>
  0 siblings, 1 reply; 4+ messages in thread
From: despen @ 2010-10-26  0:40 UTC (permalink / raw)
  To: help-gnu-emacs


I  often need  to redo  query-replace, usually with slightly different
arguments.

I first do M-% aaa bbb.

Then I want to repeat the command to maybe replace xxx by bbb.

I do C-x ESC ESC (repeat-complex-command)

I then see at least 2 lines in the mini-buffer reading:

redo: (query-replace "aaa" "bbb" nil (if
 (and transient-mark-mode mark-active)
 (region-beginning))
 (if (and transient-mark-mode mark-active) (region-end)))

Why is all that ?JUNK? there.  It's not so easy to get back to
the "bbb" part and change it.

I'd really like to see something like:

redo: (query-replace "aaa" "bbb")

I tried this with emacs -q and got the same results.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: repeat-complex-command too complex
       [not found]   ` <icmxq1m3cc.fsf@verizon.net>
@ 2010-10-27  6:33     ` Barry Margolin
  2010-10-27 13:34       ` despen
  0 siblings, 1 reply; 4+ messages in thread
From: Barry Margolin @ 2010-10-27  6:33 UTC (permalink / raw)
  To: help-gnu-emacs

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.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: repeat-complex-command too complex
  2010-10-27  6:33     ` Barry Margolin
@ 2010-10-27 13:34       ` despen
  2010-10-27 13:54         ` Andreas Politz
  0 siblings, 1 reply; 4+ messages in thread
From: despen @ 2010-10-27 13:34 UTC (permalink / raw)
  To: help-gnu-emacs

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!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: repeat-complex-command too complex
  2010-10-27 13:34       ` despen
@ 2010-10-27 13:54         ` Andreas Politz
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Politz @ 2010-10-27 13:54 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-27 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26  0:40 repeat-complex-command too complex despen
     [not found] ` <barmar-12C417.00343426102010@reserved-multicast-range-not-delegated.example.com>
     [not found]   ` <icmxq1m3cc.fsf@verizon.net>
2010-10-27  6:33     ` Barry Margolin
2010-10-27 13:34       ` despen
2010-10-27 13:54         ` Andreas Politz

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