all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* call-interactively 'query-replace and 'isearch-forward
@ 2013-03-11 15:54 Thorsten Jolitz
  2013-03-11 16:08 ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Jolitz @ 2013-03-11 15:54 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

I call-interactively 'query-replace and 'isearch-forward in a program,
and the former works as expected (ask me for input), the latter not
(just make the window blink). 

Trying the same calls in *scratch* buffer shows only a tiny difference:

,------------------------------------
| (call-interactively 'query-replace)
`------------------------------------

asks for input and moves point to mini-buffer, while 

,--------------------------------------
| (call-interactively 'isearch-forward)
`--------------------------------------

returns t, asks for input (I-search: ) - but leaves point in the
scratch-buffer behind the returned t. 

Is there a known problem with calling 'isearch-forward' interactively?
How can I make that work?

-- 
cheers,
Thorsten





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

* RE: call-interactively 'query-replace and 'isearch-forward
  2013-03-11 15:54 call-interactively 'query-replace and 'isearch-forward Thorsten Jolitz
@ 2013-03-11 16:08 ` Drew Adams
  2013-03-11 16:21   ` Thorsten Jolitz
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2013-03-11 16:08 UTC (permalink / raw)
  To: 'Thorsten Jolitz', help-gnu-emacs

> I call-interactively 'query-replace and 'isearch-forward in a program,
> and the former works as expected (ask me for input), the latter not
> (just make the window blink). 
>
> Is there a known problem with calling 'isearch-forward' interactively?
> How can I make that work?

No such problem known to me, at least.

If you want help, please try to provide a specific recipe, starting from emacs
-Q.  Indicate what happens at each place where something you do not expect
happens, and state what behavior you expected instead.

This works as I would expect:

emacs -Q

(defun foo ()
  (interactive)
  (call-interactively #'isearch-forward))

M-x foo

Does that not do what you expect?





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

* Re: call-interactively 'query-replace and 'isearch-forward
  2013-03-11 16:08 ` Drew Adams
@ 2013-03-11 16:21   ` Thorsten Jolitz
  2013-03-11 16:46     ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Jolitz @ 2013-03-11 16:21 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

> This works as I would expect:
>
> emacs -Q
>
> (defun foo ()
>   (interactive)
>   (call-interactively #'isearch-forward))
>
> M-x foo
>
> Does that not do what you expect?

Try:

,------------------------------------------
| emacs -Q
| 
| (defun foo ()
|   (interactive)
|   (call-interactively #'isearch-forward)
|   (call-interactively #'query-replace))
| 
| (defun bar ()
|   (interactive)
|   (call-interactively #'query-replace)
|   (call-interactively #'isearch-forward))
| 
| M-x foo
| M-x bar
`------------------------------------------

Both do the same thing: ask for input for 'query-replace'.

'isearch-forward' is simply skipped when calling 'foo'.

-- 
cheers,
Thorsten




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

* RE: call-interactively 'query-replace and 'isearch-forward
  2013-03-11 16:21   ` Thorsten Jolitz
@ 2013-03-11 16:46     ` Drew Adams
  2013-03-11 17:10       ` Thorsten Jolitz
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2013-03-11 16:46 UTC (permalink / raw)
  To: 'Thorsten Jolitz', help-gnu-emacs

> ,------------------------------------------
> | emacs -Q
> | 
> | (defun foo ()
> |   (interactive)
> |   (call-interactively #'isearch-forward)
> |   (call-interactively #'query-replace))
> | 
> | (defun bar ()
> |   (interactive)
> |   (call-interactively #'query-replace)
> |   (call-interactively #'isearch-forward))
> | 
> | M-x foo
> | M-x bar
> `------------------------------------------
> 
> Both do the same thing: ask for input for 'query-replace'.
> 'isearch-forward' is simply skipped when calling 'foo'.

Actually, `isearch-forward' is not skipped in either case.

In the case of `bar', there is no problem: just follow through with
query-replacing (ending it when you are done), and you will see that you enter
Isearch normally. 

The problem is that in the case of `foo', Isearch is entered but more or less
immediately ends.  I did not bother to step through the debugger or study the
code to see why.  Perhaps someone will do that and reply.

But here is something that works for `foo':

(defun foo ()
  (interactive)
  (isearch-mode t nil nil t nil)
  (call-interactively #'query-replace))




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

* Re: call-interactively 'query-replace and 'isearch-forward
  2013-03-11 16:46     ` Drew Adams
@ 2013-03-11 17:10       ` Thorsten Jolitz
  0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Jolitz @ 2013-03-11 17:10 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

>> ,------------------------------------------
>> | emacs -Q
>> | 
>> | (defun foo ()
>> |   (interactive)
>> |   (call-interactively #'isearch-forward)
>> |   (call-interactively #'query-replace))
>> | 
>> | (defun bar ()
>> |   (interactive)
>> |   (call-interactively #'query-replace)
>> |   (call-interactively #'isearch-forward))
>> | 
>> | M-x foo
>> | M-x bar
>> `------------------------------------------
>> 
>> Both do the same thing: ask for input for 'query-replace'.
>> 'isearch-forward' is simply skipped when calling 'foo'.
>
> Actually, `isearch-forward' is not skipped in either case.
>
> In the case of `bar', there is no problem: just follow through with
> query-replacing (ending it when you are done), and you will see that
> you enter Isearch normally.
>
> The problem is that in the case of `foo', Isearch is entered but more
> or less immediately ends. I did not bother to step through the
> debugger or study the code to see why. Perhaps someone will do that
> and reply.

Thats what I noticed as a quick window blink. I'm not so much interested
in the deep root cause of the problem, but rather in a working solution. 

> But here is something that works for `foo':
>
> (defun foo ()
>   (interactive)
>   (isearch-mode t nil nil t nil)
>   (call-interactively #'query-replace))

And this is a working solution - thanks a lot. 

-- 
cheers,
Thorsten




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

end of thread, other threads:[~2013-03-11 17:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-11 15:54 call-interactively 'query-replace and 'isearch-forward Thorsten Jolitz
2013-03-11 16:08 ` Drew Adams
2013-03-11 16:21   ` Thorsten Jolitz
2013-03-11 16:46     ` Drew Adams
2013-03-11 17:10       ` Thorsten Jolitz

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.