unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* I-search: Clicking in minibuf during I-search fails.
@ 2007-10-10  3:16 amicitas
  2007-10-10 13:55 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: amicitas @ 2007-10-10  3:16 UTC (permalink / raw)
  To: bug-gnu-emacs

I have run across what appears to be a bug in emacs-22.

When i start an i-search (normal or regex) and try to click in the
minibuffer the minibuf closes, the window is split and the *message*
buffer is displayed.  There are no new messages desplayed in
*messages*.

I have not seen this behavior with the mini buffer in any other cases
(such as replace).

I cannot find any mention of this type of behavior online.

GNU Emacs 22.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.0)
 of 2007-10-04 on palmer, modified by Ubuntu
(22.1-0ubuntu5)

Running on Ubuntu 7.10 (2.6.22-14.41)



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

* RE: I-search: Clicking in minibuf during I-search fails.
  2007-10-10  3:16 I-search: Clicking in minibuf during I-search fails amicitas
@ 2007-10-10 13:55 ` Drew Adams
  2007-10-10 21:03 ` Richard Stallman
       [not found] ` <mailman.1937.1192050272.18990.bug-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 17+ messages in thread
From: Drew Adams @ 2007-10-10 13:55 UTC (permalink / raw)
  To: amicitas, bug-gnu-emacs

> I have run across what appears to be a bug in emacs-22.
>
> When i start an i-search (normal or regex) and try to click in the
> minibuffer the minibuf closes, the window is split and the *message*
> buffer is displayed.  There are no new messages desplayed in
> *messages*.
>
> I have not seen this behavior with the mini buffer in any other cases
> (such as replace).
>
> I cannot find any mention of this type of behavior online.
>
> GNU Emacs 22.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.0)
>  of 2007-10-04 on palmer, modified by Ubuntu
> (22.1-0ubuntu5)
>
> Running on Ubuntu 7.10 (2.6.22-14.41)

Isearch does not in fact use the minibuffer. It uses the echo area, which
occupies the same screen real estate.

Starting with Emacs 22, anytime you click in the echo area (not the
minibuffer), buffer *Messages* is displayed.

See the Isearch doc for how to interact with Isearch, including how to edit
a search string (which is presumably why you tried to click there).





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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-10  3:16 I-search: Clicking in minibuf during I-search fails amicitas
  2007-10-10 13:55 ` Drew Adams
@ 2007-10-10 21:03 ` Richard Stallman
       [not found] ` <mailman.1937.1192050272.18990.bug-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 17+ messages in thread
From: Richard Stallman @ 2007-10-10 21:03 UTC (permalink / raw)
  To: amicitas; +Cc: bug-gnu-emacs

    When i start an i-search (normal or regex) and try to click in the
    minibuffer the minibuf closes, the window is split and the *message*
    buffer is displayed.  There are no new messages desplayed in
    *messages*.

It is a feature, a way to see the *Messages* buffer.

What did you expect it to do?




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

* Re: I-search: Clicking in minibuf during I-search fails.
       [not found] ` <mailman.1937.1192050272.18990.bug-gnu-emacs@gnu.org>
@ 2007-10-10 21:51   ` amicitas
  2007-10-10 23:44     ` Juri Linkov
       [not found]     ` <mailman.1940.1192060132.18990.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 17+ messages in thread
From: amicitas @ 2007-10-10 21:51 UTC (permalink / raw)
  To: bug-gnu-emacs

Ok I see.  What I expected was to be able to edit the search string.
Especially since middle clicking in the echo area does do a paste.
I will go read the Isearch docs as you suggest and try to avoid
clicking the echo area.

Thank you very much for your clarification on this. Sorry about the
bogus bug report.



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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-10 21:51   ` amicitas
@ 2007-10-10 23:44     ` Juri Linkov
  2007-10-12  2:46       ` Richard Stallman
       [not found]     ` <mailman.1940.1192060132.18990.bug-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 17+ messages in thread
From: Juri Linkov @ 2007-10-10 23:44 UTC (permalink / raw)
  To: amicitas; +Cc: bug-gnu-emacs

> Ok I see.  What I expected was to be able to edit the search string.
> Especially since middle clicking in the echo area does do a paste.
> I will go read the Isearch docs as you suggest and try to avoid
> clicking the echo area.

Thank you for your report.  Your request is reasonable.  It is natural to
expect that clicking in the echo area where the search string is visible
will allow editing this search string.  This behavior is easily
implementable with the following patch:

Index: lisp/isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.303
diff -c -r1.303 isearch.el
*** lisp/isearch.el	29 Aug 2007 05:28:05 -0000	1.303
--- lisp/isearch.el	10 Oct 2007 23:44:04 -0000
***************
*** 1738,1743 ****
--- 1738,1747 ----
                   (isearch-back-into-window (eq ab-bel 'above) isearch-point)
                 (goto-char isearch-point)))
             (isearch-update))
+ 	  ((window-minibuffer-p (posn-window (event-start main-event)))
+ 	   ;; Swallow the up-event.
+ 	   (read-event)
+ 	   (isearch-edit-string))
  	  (search-exit-option
  	   (let (window)
               (isearch-unread-key-sequence keylist)

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-10 23:44     ` Juri Linkov
@ 2007-10-12  2:46       ` Richard Stallman
  2007-10-28 14:51         ` Juri Linkov
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2007-10-12  2:46 UTC (permalink / raw)
  To: Juri Linkov; +Cc: bug-gnu-emacs, amicitas

    Thank you for your report.  Your request is reasonable.  It is natural to
    expect that clicking in the echo area where the search string is visible
    will allow editing this search string.  This behavior is easily
    implementable with the following patch:

If he says it gives good results, please install it.

Thanks.




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

* Re: I-search: Clicking in minibuf during I-search fails.
       [not found]     ` <mailman.1940.1192060132.18990.bug-gnu-emacs@gnu.org>
@ 2007-10-14 23:34       ` amicitas
  2007-10-19 23:52         ` Juri Linkov
  0 siblings, 1 reply; 17+ messages in thread
From: amicitas @ 2007-10-14 23:34 UTC (permalink / raw)
  To: bug-gnu-emacs

That works well. I will definitely use this patch since I have been
clicking in that echo area during searches for years (and always
wishing that it did something).

There is some unwanted behavior with this patch.
 - On initially clicking into the bar the cursor is at the end of the
string, when then clicking into the middle of the string, the
minibuffer to the left of the cursor position is highlighted, and
therefore copied.  This would prevent me from say pasting into the
middle of a search string using the mouse.  There is no problem
however using the keyboard to navigate to the selected place in the
string and then pasting.

Thank you very much for the patch.  I really appreciate the help here.

Novimir Pablant



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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-14 23:34       ` amicitas
@ 2007-10-19 23:52         ` Juri Linkov
  2007-10-21  7:26           ` Richard Stallman
  0 siblings, 1 reply; 17+ messages in thread
From: Juri Linkov @ 2007-10-19 23:52 UTC (permalink / raw)
  To: amicitas; +Cc: bug-gnu-emacs

> That works well. I will definitely use this patch since I have been
> clicking in that echo area during searches for years (and always
> wishing that it did something).
>
> There is some unwanted behavior with this patch.
>  - On initially clicking into the bar the cursor is at the end of the
> string, when then clicking into the middle of the string, the
> minibuffer to the left of the cursor position is highlighted, and
> therefore copied.  This would prevent me from say pasting into the
> middle of a search string using the mouse.  There is no problem
> however using the keyboard to navigate to the selected place in the
> string and then pasting.

Actually this bug is not caused by my patch, but it exists in CVS.
It can be reproduced by typing `C-s string M-e' or `C-s RET',
and clicking mouse-1 in the minibuffer.  This makes the selection on
the minibuffer prompt instead of putting point to a different place.

This bug is caused by the hack in `isearch-edit-string' that uses

    (let ((cursor-in-echo-area t))
         (read-event))

before reading the search string in the minibuffer with
`read-from-minibuffer'.  When clicking mouse-1 in `read-event'
above, it incorrectly handles the mouse click.

This hack is used to start reading words after `C-s RET C-w' for word
search.  A simpler solution I think would be to bind `C-w' in
minibuffer-local-isearch-map to change the search type after typing
C-w in the minibuffer that read the search string, but it seems
it can't change the prompt from "I-search:" to "Word I-search:"
when the prompt is already displayed by read-from-minibuffer.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-19 23:52         ` Juri Linkov
@ 2007-10-21  7:26           ` Richard Stallman
  2007-10-22  0:35             ` Juri Linkov
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2007-10-21  7:26 UTC (permalink / raw)
  To: Juri Linkov; +Cc: bug-gnu-emacs, amicitas

    This bug is caused by the hack in `isearch-edit-string' that uses

	(let ((cursor-in-echo-area t))
	     (read-event))

    before reading the search string in the minibuffer with
    `read-from-minibuffer'.  When clicking mouse-1 in `read-event'
    above, it incorrectly handles the mouse click.

Why does this code handle the mouse-click at all?
It ought to just return the event, right?




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-21  7:26           ` Richard Stallman
@ 2007-10-22  0:35             ` Juri Linkov
  2007-10-23  7:12               ` Richard Stallman
  0 siblings, 1 reply; 17+ messages in thread
From: Juri Linkov @ 2007-10-22  0:35 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, amicitas

>     This bug is caused by the hack in `isearch-edit-string' that uses
>
> 	(let ((cursor-in-echo-area t))
> 	     (read-event))
>
>     before reading the search string in the minibuffer with
>     `read-from-minibuffer'.  When clicking mouse-1 in `read-event'
>     above, it incorrectly handles the mouse click.
>
> Why does this code handle the mouse-click at all?
> It ought to just return the event, right?

It doesn't read the mouse button release event (mouse-1), so the mouse
release happens in the minibuffer after read-from-minibuffer activates it.
Thus, mouse-1 selects the region because read-from-minibuffer with the
pressed down-mouse-1 puts the mark to the beginning of the minibuffer
(before the prompt).

Below is the test case that emulates this problem in `isearch-edit-string':

(progn
  (message "Prompt: ")
  (let ((cursor-in-echo-area t))
    (read-event))
  (read-from-minibuffer "Prompt: "))

after evaluating you can try to press mouse-1 in the echo area,
and release it in the minibuffer.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-22  0:35             ` Juri Linkov
@ 2007-10-23  7:12               ` Richard Stallman
  2007-10-23 23:52                 ` Juri Linkov
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2007-10-23  7:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: bug-gnu-emacs, amicitas

    It doesn't read the mouse button release event (mouse-1), so the mouse
    release happens in the minibuffer after read-from-minibuffer activates it.

I see.

It could detect that e is a down-event and reads the next event too,
then unreads both after.  Does that approach work?

If it does, we could make a subroutine to use instead of read-event,
which would take care of this, and would return a list of one or two
events.




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-23  7:12               ` Richard Stallman
@ 2007-10-23 23:52                 ` Juri Linkov
  2007-10-24  8:33                   ` Richard Stallman
  0 siblings, 1 reply; 17+ messages in thread
From: Juri Linkov @ 2007-10-23 23:52 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, amicitas

>     It doesn't read the mouse button release event (mouse-1), so the mouse
>     release happens in the minibuffer after read-from-minibuffer activates it.
>
> I see.
>
> It could detect that e is a down-event and reads the next event too,
> then unreads both after.  Does that approach work?

It works, but there are still problems.  The recorded event has the
position of the beginning of the echo area, so after unreading this
event of clicking the button in the echo area, it puts point to the
beginning of the minibuffer before the prompt.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-23 23:52                 ` Juri Linkov
@ 2007-10-24  8:33                   ` Richard Stallman
  2007-10-24 21:28                     ` Juri Linkov
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2007-10-24  8:33 UTC (permalink / raw)
  To: Juri Linkov; +Cc: bug-gnu-emacs, amicitas

    It works, but there are still problems.  The recorded event has the
    position of the beginning of the echo area,

Is that the wrong position?  If so, in what way is it wrong?




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-24  8:33                   ` Richard Stallman
@ 2007-10-24 21:28                     ` Juri Linkov
  2007-10-25  9:01                       ` Richard Stallman
  0 siblings, 1 reply; 17+ messages in thread
From: Juri Linkov @ 2007-10-24 21:28 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, amicitas

>     It works, but there are still problems.  The recorded event has the
>     position of the beginning of the echo area,
>
> Is that the wrong position?  If so, in what way is it wrong?

The beginning of the minibuffer is the wrong position to put point,
because the prompt is read-only, and to start editing the user needs to
move point to the editable area.  The right position is where the mouse
was clicked, or at least in the end of the minibuffer where point is
placed after calling isearch-edit-string.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-24 21:28                     ` Juri Linkov
@ 2007-10-25  9:01                       ` Richard Stallman
  2007-10-26 22:43                         ` Juri Linkov
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2007-10-25  9:01 UTC (permalink / raw)
  To: Juri Linkov; +Cc: bug-gnu-emacs, amicitas

    The beginning of the minibuffer is the wrong position to put point,
    because the prompt is read-only, and to start editing the user needs to
    move point to the editable area.  The right position is where the mouse
    was clicked,

Ok, now I understand you.  Indeed, that is the right position.

So why does the event have the wrong position in it?




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-25  9:01                       ` Richard Stallman
@ 2007-10-26 22:43                         ` Juri Linkov
  0 siblings, 0 replies; 17+ messages in thread
From: Juri Linkov @ 2007-10-26 22:43 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, amicitas

>     The beginning of the minibuffer is the wrong position to put point,
>     because the prompt is read-only, and to start editing the user needs to
>     move point to the editable area.  The right position is where the mouse
>     was clicked,
>
> Ok, now I understand you.  Indeed, that is the right position.
>
> So why does the event have the wrong position in it?

I guess this is because clicking mouse button with the code

(let ((cursor-in-echo-area t))
    (read-event))

always returns an event where the buffer position is 1.

PS: I already suggested trying an alternative solution that gets rid of
using `read-event', and binds C-w to a new command in the minibuffer
for editing the search string.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: I-search: Clicking in minibuf during I-search fails.
  2007-10-12  2:46       ` Richard Stallman
@ 2007-10-28 14:51         ` Juri Linkov
  0 siblings, 0 replies; 17+ messages in thread
From: Juri Linkov @ 2007-10-28 14:51 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, amicitas

>     Thank you for your report.  Your request is reasonable.  It is natural to
>     expect that clicking in the echo area where the search string is visible
>     will allow editing this search string.  This behavior is easily
>     implementable with the following patch:
>
> If he says it gives good results, please install it.

Installed since he said it gives what he wants.  A reported problem is
not caused by this change.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

end of thread, other threads:[~2007-10-28 14:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10  3:16 I-search: Clicking in minibuf during I-search fails amicitas
2007-10-10 13:55 ` Drew Adams
2007-10-10 21:03 ` Richard Stallman
     [not found] ` <mailman.1937.1192050272.18990.bug-gnu-emacs@gnu.org>
2007-10-10 21:51   ` amicitas
2007-10-10 23:44     ` Juri Linkov
2007-10-12  2:46       ` Richard Stallman
2007-10-28 14:51         ` Juri Linkov
     [not found]     ` <mailman.1940.1192060132.18990.bug-gnu-emacs@gnu.org>
2007-10-14 23:34       ` amicitas
2007-10-19 23:52         ` Juri Linkov
2007-10-21  7:26           ` Richard Stallman
2007-10-22  0:35             ` Juri Linkov
2007-10-23  7:12               ` Richard Stallman
2007-10-23 23:52                 ` Juri Linkov
2007-10-24  8:33                   ` Richard Stallman
2007-10-24 21:28                     ` Juri Linkov
2007-10-25  9:01                       ` Richard Stallman
2007-10-26 22:43                         ` Juri Linkov

Code repositories for project(s) associated with this public inbox

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

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