From: Dmitry Gutov <dgutov@yandex.ru>
To: Kim Storm <storm@cua.dk>
Cc: 12796@debbugs.gnu.org
Subject: bug#12796: Optimize `ido-completing-read' for larger lists with flex matching enabled
Date: Wed, 07 Nov 2012 09:41:00 +0400 [thread overview]
Message-ID: <5099F46C.7060301@yandex.ru> (raw)
In-Reply-To: <5098EE91.9000906@cua.dk>
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)
next prev parent reply other threads:[~2012-11-07 5:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-04 5:58 bug#12796: Optimize `ido-completing-read' for larger lists with flex matching enabled Dmitry Gutov
2012-11-04 8:32 ` Leo
2012-11-04 13:53 ` Stefan Monnier
2012-11-04 17:05 ` Dmitry Gutov
2012-11-05 5:37 ` Dmitry Gutov
2012-11-06 1:45 ` Stefan Monnier
2012-11-06 11:03 ` Kim Storm
2012-11-06 15:38 ` Dmitry Gutov
2012-11-06 16:45 ` Kim Storm
2012-11-07 5:41 ` Dmitry Gutov [this message]
2012-11-05 20:57 ` Dmitry Gutov
2012-11-07 2:27 ` Leo
2012-11-07 4:06 ` Dmitry Gutov
2012-11-07 10:38 ` Leo
2012-11-07 21:54 ` Dmitry Gutov
2012-11-08 2:00 ` Leo
2012-11-08 4:14 ` Stefan Monnier
2012-11-08 7:36 ` Leo
2012-11-08 14:05 ` Stefan Monnier
2012-11-10 17:52 ` Dmitry Gutov
2012-11-10 22:51 ` Stefan Monnier
2012-11-10 23:01 ` Dmitry Gutov
2012-11-10 23:31 ` Stefan Monnier
2020-09-13 16:14 ` Lars Ingebrigtsen
2012-11-08 2:05 ` Stefan Monnier
2012-11-08 4:29 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5099F46C.7060301@yandex.ru \
--to=dgutov@yandex.ru \
--cc=12796@debbugs.gnu.org \
--cc=storm@cua.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).