From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: C-f in isearch's non-incremental minibuffer edit Date: Sat, 16 Apr 2005 08:53:13 -0400 Message-ID: <87br8e6gt8.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1113656398 29628 80.91.229.2 (16 Apr 2005 12:59:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 16 Apr 2005 12:59:58 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 16 14:59:57 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DMmtk-0002xM-T3 for ged-emacs-devel@m.gmane.org; Sat, 16 Apr 2005 14:59:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DMmxS-0001Y6-Is for ged-emacs-devel@m.gmane.org; Sat, 16 Apr 2005 09:03:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DMmvd-0000EO-AD for emacs-devel@gnu.org; Sat, 16 Apr 2005 09:01:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DMmvZ-0000Ct-Nj for emacs-devel@gnu.org; Sat, 16 Apr 2005 09:01:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DMmvY-0008IZ-F7 for emacs-devel@gnu.org; Sat, 16 Apr 2005 09:01:36 -0400 Original-Received: from [209.226.175.4] (helo=tomts16-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DMmoX-0000GH-6t for emacs-devel@gnu.org; Sat, 16 Apr 2005 08:54:21 -0400 Original-Received: from alfajor ([65.92.240.112]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050416125314.OHKS27508.tomts16-srv.bellnexxia.net@alfajor>; Sat, 16 Apr 2005 08:53:14 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id F394AD7399; Sat, 16 Apr 2005 08:53:13 -0400 (EDT) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36039 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36039 If you hit M-e in isearch (isearch-eidt-string), you're put in a normal minibuffer where you can edit your search string with the usual command (but not incrementally any more). This comes in handy at times. But I recently noticed that it behaves very strangely: if I move point towards the end with something like C-f, when I reach the end of the minibuffer instead of getting the usual beep I see chars from the main buffer being added. It seems like it's a new "feature", but it looks much more like a bug to me. It was introduced as part of: * isearch.el (isearch-mode-map): Bind C-M-w to isearch-del-char, C-M-y to isearch-yank-char. Bind M-% to isearch-query-replace, C-M-% to isearch-query-replace-regexp. (minibuffer-local-isearch-map): Add arrow key bindings. Bind C-f to isearch-yank-char-in-minibuffer. (isearch-forward): Doc fix. (isearch-edit-string): Doc fix. (isearch-query-replace, isearch-query-replace-regexp): New funs. (isearch-del-char): Add optional arg. Set isearch-yank-flag to t. (isearch-yank-char): Add optional arg. (isearch-yank-char-in-minibuffer): New fun. and I strongly suggest we revert this part of the change: the point of the isearch-edit-string functionality is to get back a *normal* minibuffer. While I'm at it, I also suggest we make isearch-edit-string use the usual history functionality, so it behaves even more normally. See patch below. The important part is the one concerning isearch-yank-char-in-minibuffer: I think it is important to remove those surprising bindings. If you object to this patch, please specify if you object to both changes (the isearch-yank-char-in-minibuffer and the history part) or to only one of the two. Stefan --- orig/lisp/isearch.el +++ mod/lisp/isearch.el @@ -403,17 +403,9 @@ (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) (define-key map "\r" 'isearch-nonincremental-exit-minibuffer) - (define-key map "\M-n" 'isearch-ring-advance-edit) - (define-key map [next] 'isearch-ring-advance-edit) - (define-key map [down] 'isearch-ring-advance-edit) - (define-key map "\M-p" 'isearch-ring-retreat-edit) - (define-key map [prior] 'isearch-ring-retreat-edit) - (define-key map [up] 'isearch-ring-retreat-edit) (define-key map "\M-\t" 'isearch-complete-edit) (define-key map "\C-s" 'isearch-forward-exit-minibuffer) (define-key map "\C-r" 'isearch-reverse-exit-minibuffer) - (define-key map "\C-f" 'isearch-yank-char-in-minibuffer) - (define-key map [right] 'isearch-yank-char-in-minibuffer) map) "Keymap for editing isearch strings in the minibuffer.") @@ -911,8 +903,6 @@ \\[isearch-nonincremental-exit-minibuffer] to do one nonincremental search. \\[isearch-forward-exit-minibuffer] to resume isearching forward. \\[isearch-reverse-exit-minibuffer] to resume isearching backward. -\\[isearch-ring-advance-edit] to replace the search string with the next item in the search ring. -\\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. \\[isearch-complete-edit] to complete the search string using the search ring. \\ If first char entered is \\[isearch-yank-word-or-char], then do word search instead." @@ -998,12 +988,12 @@ (isearch-unread e)) (setq cursor-in-echo-area nil) (setq isearch-new-string - (let (junk-ring) - (read-from-minibuffer - (isearch-message-prefix nil isearch-nonincremental) - isearch-string - minibuffer-local-isearch-map nil - 'junk-ring nil t)) + (read-from-minibuffer + (isearch-message-prefix nil isearch-nonincremental) + isearch-string + minibuffer-local-isearch-map nil + (if isearch-regexp 'regexp-search-ring 'search-ring) + nil t) isearch-new-message (mapconcat 'isearch-text-char-description isearch-new-string ""))) @@ -1358,17 +1348,6 @@ (goto-char isearch-other-end)) (buffer-substring-no-properties (point) (funcall jumpform))))) -(defun isearch-yank-char-in-minibuffer (&optional arg) - "Pull next character from buffer into end of search string in minibuffer." - (interactive "p") - (if (eobp) - (insert - (save-excursion - (set-buffer (cadr (buffer-list))) - (buffer-substring-no-properties - (point) (progn (forward-char arg) (point))))) - (forward-char arg))) - (defun isearch-yank-char (&optional arg) "Pull next character from buffer into search string." (interactive "p") @@ -1912,49 +1891,6 @@ (interactive) (isearch-ring-adjust nil)) -(defun isearch-ring-advance-edit (n) - "Insert the next element of the search history into the minibuffer. -With prefix arg N, insert the Nth element." - (interactive "p") - (let* ((yank-pointer-name (if isearch-regexp - 'regexp-search-ring-yank-pointer - 'search-ring-yank-pointer)) - (yank-pointer (eval yank-pointer-name)) - (ring (if isearch-regexp regexp-search-ring search-ring)) - (length (length ring))) - (if (zerop length) - () - (set yank-pointer-name - (setq yank-pointer - (mod (- (or yank-pointer 0) n) - length))) - - (delete-field) - (insert (nth yank-pointer ring)) - (goto-char (point-max))))) - -(defun isearch-ring-retreat-edit (n) - "Insert the previous element of the search history into the minibuffer. -With prefix arg N, insert the Nth element." - (interactive "p") - (isearch-ring-advance-edit (- n))) - -;;(defun isearch-ring-adjust-edit (advance) -;; "Use the next or previous search string in the ring while in minibuffer." -;; (isearch-ring-adjust1 advance) -;; (erase-buffer) -;; (insert isearch-string)) - -;;(defun isearch-ring-advance-edit () -;; (interactive) -;; (isearch-ring-adjust-edit 'advance)) - -;;(defun isearch-ring-retreat-edit () -;; "Retreat to the previous search string in the ring while in the minibuffer." -;; (interactive) -;; (isearch-ring-adjust-edit nil)) - - (defun isearch-complete1 () ;; Helper for isearch-complete and isearch-complete-edit ;; Return t if completion OK, nil if no completion exists.