"Charles Hines" <chuck_hines(a)VNET.IBM.COM> writes:
So I played with just applying the location of isearch-push-state
change in isearch-ring-adjust, which seemed to fix it for forward
searching but it was still broken for backwards searching.
To be able to fix the bug, you have to understand the problem. In
this case, the problem was that, when you type `C-s M-p', you *appear*
to be prompted for an empty string. But that's, in fact, not the
case. Try tryping a letter, and you see that the search string is in
fact there. That is why pressing M-p twice backs up the search twice.
The problem is with the code in isearch-edit-string that reads in the
next event to see if it will be a key bound to isearch-yank-word. In
fact, the code is correct (it correctly reshuffles the event back to
the event loop), but the author forgot that he needs to print out the
whole message to the user, so that it's obvious what's going on.
So, all that is needed to fix the bug is to add an `isearch-message'
at an appropriate place. The latest incarnation of that code looks
like this:
[...]
;; Actually terminate isearching until editing is done.
;; This is so that the user can do anything without failure,
;; like switch buffers and start another isearch, and return.
;; (condition-case nil
(isearch-done t t)
;;#### What does this mean? There is no such condition!
;; (exit nil)) ; was recursive editing
(unwind-protect
(progn
;; Fake the prompt message for the sake of
;; next-command-event below.
(isearch-message)
;; If the first character the user types when we
;; prompt them for a string is the yank-word
;; character, then go into word-search mode.
;; Otherwise unread that character and read a string
;; the normal way.
(let* ((cursor-in-echo-area t)
(event (next-command-event)))
(if (eq 'isearch-yank-word
(lookup-key isearch-mode-map (vector event)))
(setq isearch-word t;; so message-prefix is right
isearch-new-word t)
(setq unread-command-event event)))
(setq isearch-new-string
(read-from-minibuffer
(isearch-message-prefix nil isearch-nonincremental)
isearch-string
minibuffer-local-isearch-map
nil
't ;does its own history (but shouldn't)
)
isearch-new-message (mapconcat
'isearch-text-char-description
isearch-new-string "")))
[...]