* ido.el: swallowing superfluous RET key
@ 2004-04-10 4:02 Karl Chen
2004-04-10 22:17 ` Kim F. Storm
0 siblings, 1 reply; 2+ messages in thread
From: Karl Chen @ 2004-04-10 4:02 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ido.el: swallowing superfluous RET key
2004-04-10 4:02 ido.el: swallowing superfluous RET key Karl Chen
@ 2004-04-10 22:17 ` Kim F. Storm
0 siblings, 0 replies; 2+ messages in thread
From: Kim F. Storm @ 2004-04-10 22:17 UTC (permalink / raw)
Cc: Emacs Developement List
Karl Chen <quarl@hkn.eecs.berkeley.edu> writes:
> 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).
>
Well, this is a useful hack for you, but IMHO a little obscure to add
in general.
Instead, it would seem more logical to have an option to always
reqiure RET after TAB (which is the effect of the other patch you
sent).
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-04-10 22:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-10 4:02 ido.el: swallowing superfluous RET key Karl Chen
2004-04-10 22:17 ` Kim F. Storm
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).