From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Karl Chen Newsgroups: gmane.emacs.devel Subject: ido.el: swallowing superfluous RET key Date: 09 Apr 2004 21:02:47 -0700 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1081569907 11710 80.91.224.253 (10 Apr 2004 04:05:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 10 Apr 2004 04:05:07 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Apr 10 06:05:02 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BC9jq-000698-00 for ; Sat, 10 Apr 2004 06:05:02 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BC9jq-00072J-00 for ; Sat, 10 Apr 2004 06:05:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BC9iN-0002zp-50 for emacs-devel@quimby.gnus.org; Sat, 10 Apr 2004 00:03:31 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BC9iI-0002w5-O4 for emacs-devel@gnu.org; Sat, 10 Apr 2004 00:03:26 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BC9hj-0002Fh-OS for emacs-devel@gnu.org; Sat, 10 Apr 2004 00:03:22 -0400 Original-Received: from [128.32.47.228] (helo=hkn.eecs.berkeley.edu) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.30) id 1BC9hj-0002FJ-7a for emacs-devel@gnu.org; Sat, 10 Apr 2004 00:02:51 -0400 Original-Received: from quarl by hkn.eecs.berkeley.edu with local id 1BC9hf-0003kS-00; Fri, 09 Apr 2004 21:02:47 -0700 Original-To: "Kim F. Storm" , Emacs Developement List X-Quack-Archive: 1 Original-Lines: 38 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21435 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21435 The behavior for finding files/buffers on TAB without requiring RET is nice, but I still press RET out of habit, or because I expect it to be the fist but not unique match. I've been using the advice code below to swallow unnecessary RETs; this code could be useful if built-in to ido.el (maybe default off). (defun kc--key-is-return (key) (or (eq key 13) (eq key 'return) (eq key 'kp-enter))) ;; I'm used to typing TAB-RET to complete a filename, but the RET is ;; unnecessary if unique, with IDO. (defun kc-ido-absorb-ret () "If the next key is a RET within 1 second, ignore it." (with-timeout (1) (let ((event (read-event))) (if (kc--key-is-return event) (message "Swallowed unnecessary RET key") (push event unread-command-events))))) (defun kc-ido-absorb-ret-on-completion () (if (eq this-command 'ido-complete) (kc-ido-absorb-ret))) (defadvice ido-find-file (after kc-ido-absorb-ret-on-completion activate) (kc-ido-absorb-ret-on-completion)) (defadvice ido-switch-buffer (after kc-ido-absorb-ret-on-completion activate) (kc-ido-absorb-ret-on-completion)) -- Karl 2004-04-09 20:58