I'd like to have occur's prompt in the minibuffer do the same that isearch does:
C-w inserts the word at point in the main buffer into the minibuffer prompt. That keybinding, when doing isearch, calls
isearch-yank-word-or-char, so based on other questions, it seems like
(define-key minibuffer-local-map (kbd "C-w") 'isearch-yank-word-or-char)
would make the same thing work for occur /
M-s o. But when I do the above and use
C-w, I get
[End of buffer] as an error message.
The remapping is working; if I do:
(defun myfunc () (interactive) (message "myfunc called!")) (define-key minibuffer-local-map (kbd "C-w") 'myfunc)
it works as expected and echos "myfunc called!" in the minibuffer -- so the function call is working. Why would
isearch-yank-word-or-char correctly find something and yank it when doing isearch, but somehow fail to find anything (as I guess "end of buffer" means) when I've activated the minibuffer prompt for an occur search?