From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#12796: Optimize `ido-completing-read' for larger lists with flex matching enabled Date: Wed, 07 Nov 2012 09:41:00 +0400 Message-ID: <5099F46C.7060301@yandex.ru> References: <5096040B.50002@yandex.ru> <5096A046.6090908@yandex.ru> <509750B0.2030000@yandex.ru> <5098EE91.9000906@cua.dk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1352266874 8721 80.91.229.3 (7 Nov 2012 05:41:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Nov 2012 05:41:14 +0000 (UTC) Cc: 12796@debbugs.gnu.org To: Kim Storm Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 07 06:41:24 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TVyO9-00039b-Iu for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Nov 2012 06:41:21 +0100 Original-Received: from localhost ([::1]:52461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVyO0-0003OG-LJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Nov 2012 00:41:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVyNx-0003Nz-Sq for bug-gnu-emacs@gnu.org; Wed, 07 Nov 2012 00:41:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVyNw-00014s-Ns for bug-gnu-emacs@gnu.org; Wed, 07 Nov 2012 00:41:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVyNw-00014n-Df for bug-gnu-emacs@gnu.org; Wed, 07 Nov 2012 00:41:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TVyNq-0005X2-56 for bug-gnu-emacs@gnu.org; Wed, 07 Nov 2012 00:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Nov 2012 05:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 12796-submit@debbugs.gnu.org id=B12796.135226685921256 (code B ref 12796); Wed, 07 Nov 2012 05:41:02 +0000 Original-Received: (at 12796) by debbugs.gnu.org; 7 Nov 2012 05:40:59 +0000 Original-Received: from localhost ([127.0.0.1]:53284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TVyNm-0005Wm-NO for submit@debbugs.gnu.org; Wed, 07 Nov 2012 00:40:59 -0500 Original-Received: from forward18.mail.yandex.net ([95.108.253.143]:41433) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TVyNg-0005Wb-Vu for 12796@debbugs.gnu.org; Wed, 07 Nov 2012 00:40:56 -0500 Original-Received: from smtp18.mail.yandex.net (smtp18.mail.yandex.net [95.108.252.18]) by forward18.mail.yandex.net (Yandex) with ESMTP id B49131781991; Wed, 7 Nov 2012 09:40:56 +0400 (MSK) Original-Received: from smtp18.mail.yandex.net (localhost [127.0.0.1]) by smtp18.mail.yandex.net (Yandex) with ESMTP id 7B8F118A03E6; Wed, 7 Nov 2012 09:40:56 +0400 (MSK) Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp18.mail.yandex.net (nwsmtp/Yandex) with ESMTP id etji8vcK-eujWxrUI; Wed, 7 Nov 2012 09:40:56 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1352266856; bh=UkTGooNT4neXz8FK5bApm6qrUrT9Cyaz+sBC3xzNZag=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=WuRS3tnaOHmNhOppEO8XWlwtv7tNsrhvLB/c1L1apSuSmBAo7/XId520+B8O9fpwU P2C6CxhIetq5z06oH1RoQLgX6SVdwbzj5B77s78MkTw5ja4l4VDu/0RL6LjJwBg4U9 v4HvtYNf9UbiuUJZcKQkaQKZHfcvY/9+79eBVknM= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: <5098EE91.9000906@cua.dk> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66568 Archived-At: On 06.11.2012 15:03, Kim Storm wrote: > On 2012-11-06 02:45, Stefan Monnier wrote: >> [ Hi Kim, can you give me your opinion on this? ] >> >>> To try it, I just wrapped in it the "busy" part of `ido-set-matches-1' - >>> and indeed, no more waiting a several seconds after button >>> mashing. It's a bit buggy so far, but that's to be expected. >> To eliminate the buggy behavior, it should probably be put elsewhere, >> maybe directly in ido-exhibit (the post-command-hook). > Sounds right, but I a bit worried that some of the state information > may get corrupted if arbitrarily interrupted by user input. > > If someone proposes a patch, I'll look at it. How does this look to you? I added a new var because ido-rescan is unconditionally set to nil in many places. By the way, is there a place where ido-rotate is set to anything but nil? Does this variable actually do anything? === modified file 'lisp/ido.el' --- lisp/ido.el 2012-10-05 07:38:05 +0000 +++ lisp/ido.el 2012-11-07 05:34:53 +0000 @@ -1020,6 +1020,9 @@ (defvar ido-rotate nil "Non-nil means we are rotating list of matches.") +(defvar ido-interrupted nil + "Non-nil means calculation of matches was interrupted by keyboard input.") + (defvar ido-text nil "Stores the users string as it is typed in.") @@ -3778,9 +3781,14 @@ (defun ido-set-matches () ;; Set `ido-matches' to the list of items matching prompt - (when ido-rescan - (setq ido-matches (ido-set-matches-1 (reverse ido-cur-list) (not ido-rotate)) - ido-rotate nil))) + (when (or ido-rescan ido-interrupted) + (setq ido-interrupted t) + (while-no-input + (setq ido-matches (ido-set-matches-1 (reverse ido-cur-list) + (not ido-rotate)) + ido-interrupted nil + ido-rotate nil)) + (when ido-interrupted (setq ido-matches nil)))) (defun ido-ignore-item-p (name re-list &optional ignore-ext) ;; Return t if the buffer or file NAME should be ignored. @@ -4513,11 +4521,12 @@ (exit-minibuffer))) ;; Insert the match-status information: - (ido-set-common-completion) - (let ((inf (ido-completions contents))) - (setq ido-show-confirm-message nil) - (ido-trace "inf" inf) - (insert inf)) + (unless ido-interrupted + (ido-set-common-completion) + (let ((inf (ido-completions contents))) + (setq ido-show-confirm-message nil) + (ido-trace "inf" inf) + (insert inf))) )))) (defun ido-completions (name)