From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Fast completion with visible cue? Date: Sun, 29 Aug 2004 23:29:15 +0300 Organization: JURTA Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <87eklpzac1.fsf@mail.jurta.org> References: <20040826231346.GB15154@fencepost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1093831204 23114 80.91.224.253 (30 Aug 2004 02:00:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 Aug 2004 02:00:04 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 30 03:59:54 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C1bSb-0004Yi-00 for ; Mon, 30 Aug 2004 03:59:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C1bXO-0008SR-I5 for ged-emacs-devel@m.gmane.org; Sun, 29 Aug 2004 22:04:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C1bXH-0008Ry-58 for emacs-devel@gnu.org; Sun, 29 Aug 2004 22:04:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C1bXG-0008Rm-EQ for emacs-devel@gnu.org; Sun, 29 Aug 2004 22:04:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C1bXG-0008RV-6V for emacs-devel@gnu.org; Sun, 29 Aug 2004 22:04:42 -0400 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C1bRz-0001sA-9Z; Sun, 29 Aug 2004 21:59:15 -0400 Original-Received: from mail.jurta.org (80-235-33-157-dsl.mus.estpak.ee [80.235.33.157]) by knife.dreamhost.com (Postfix) with ESMTP id 1A03EE40ED; Sun, 29 Aug 2004 18:58:27 -0700 (PDT) Original-To: Miles Bader In-Reply-To: <20040826231346.GB15154@fencepost> (Miles Bader's message of "Thu, 26 Aug 2004 19:13:46 -0400") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:26604 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:26604 Miles Bader writes: > For cases where you want to recall something "by (non-prefix) name" just > using minibuffer history search (M-r) is also very useful. Using M-r and M-s for minibuffer history search is not too convenient: switching keys `M-r RET M-r RET M-r RET ...' is not as fast as using only one key to repeat the search for the same string. What I'm thinking about as a better alternative is using isearch for minibuffer history search. By redefining `isearch-search-fun-function' and `isearch-wrap-function' and using C-M-s and C-M-r to search the minibuffer history this is quite easy to implement. But there are some problems: 1. isearch used to search text in the minibuffer overwrites the minibuffer contents with its own text "I-search: ...". This problem could be solved by not displaying this message when the minibuffer is active, because isearch has other visible indication for the search string which is displayed in the (mini-)buffer in the `isearch' face. What is needed to be displayed in the isearch minibuffer are isearch messages about the failed isearch (perhaps, 1 sec is a sufficient delay for displaying it), and the value of an incomplete regexp (to help the user to finish writing it). So instead of the current code in the `isearch-message' function: (if c-q-hack m (let ((message-log-max nil)) (message "%s" m))) to use the following conditions: (if (or (and (minibuffer-window-active-p (selected-window)) isearch-success (not isearch-invalid-regexp)) c-q-hack) m (let ((message-log-max nil)) (message "%s" m) (when (and (minibuffer-window-active-p (selected-window)) (not isearch-invalid-regexp)) (sit-for 1) (message "")))) 2. Another question is what function to use as `isearch-search-fun-function' to search the minibuffer history. Most natural candidates are `next-matching-history-element' and `previous-matching-history-element', but they can't be used without changes. I see three possibilities: 1. to improve them to allow finding multiple occurrences of the search string in the same minibuffer history item before going to the next history item (currently, M-n and M-p search only for the first occurrence of the search string within one history item, but isearch should visit all occurences), and some other changes not affecting the current behavior of M-n and M-p, but needed for isearch. 2. to implement new functions similar to `previous-matching-history-element' suitable for using in isearch. 3. to set `isearch-wrap-function' to a function calling either `next-history-element' or `previous-history-element'. This is the most easiest solution, but this is not quite right, since it requires an additional keystroke C-s before wrapping, and moreover, wrapping should mean going to the first item of the minibuffer history ring, instead of going to the next history element. I'm most inclined to the second solution (implementing new functions). -- Juri Linkov http://www.jurta.org/emacs/