From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79924 Path: news.gmane.org!not-for-mail From: Kan-Ru Chen Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] ecomplete.el: Intercept key sequence from terminal as well. Date: Tue, 13 Sep 2011 20:43:29 +0800 Message-ID: <1315917809-9724-1-git-send-email-kanru@kanru.info> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1315917863 15373 80.91.229.12 (13 Sep 2011 12:44:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Sep 2011 12:44:23 +0000 (UTC) Cc: Lars Magne Ingebrigtsen , Kan-Ru Chen To: ding@gnus.org Original-X-From: ding-owner+M28218@lists.math.uh.edu Tue Sep 13 14:44:19 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R3SLZ-0008Jm-Kw for ding-account@gmane.org; Tue, 13 Sep 2011 14:44:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1R3SL6-00074n-UP; Tue, 13 Sep 2011 07:43:48 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1R3SL5-00074f-Rw for ding@lists.math.uh.edu; Tue, 13 Sep 2011 07:43:47 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1R3SL0-0000ry-La for ding@lists.math.uh.edu; Tue, 13 Sep 2011 07:43:47 -0500 Original-Received: from mail-yw0-f44.google.com ([209.85.213.44]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1R3SKz-0002Wp-4L; Tue, 13 Sep 2011 14:43:41 +0200 Original-Received: by ywa6 with SMTP id 6so585815ywa.17 for ; Tue, 13 Sep 2011 05:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=9NSCcImqAVGZcbpoek+QpTv1J6RGyDfWlVbvRK/EEMg=; b=WwLo1KStksEZ9OC+ImnyzSHpC9pVOwCyZUmK+/UW1tP5aTbSQiPFJkD6HmaErWYQnL we3hzKjj0f1w3lDrxtn67RJhKlwwuxvN6OT8XaSYx2nvHirECJzywn4GpdxFfKL3AzH0 rC+PN+3zYhfVFFAAbjf4LblIfHXcKUZfrpmlY= Original-Received: by 10.101.100.13 with SMTP id c13mr246194anm.108.1315917815134; Tue, 13 Sep 2011 05:43:35 -0700 (PDT) Original-Received: from isil.kanru.info (125-228-226-111.dynamic.hinet.net [125.228.226.111]) by mx.google.com with ESMTPS id p14sm2473176anh.25.2011.09.13.05.43.33 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Sep 2011 05:43:34 -0700 (PDT) Original-Received: from kanru by isil.kanru.info with local (Exim 4.76) (envelope-from ) id 1R3SKo-0002XN-9G; Tue, 13 Sep 2011 20:43:30 +0800 X-Mailer: git-send-email 1.7.5.4 X-Spam-Score: -2.9 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79924 Archived-At: --- lisp/ChangeLog | 5 +++++ lisp/ecomplete.el | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8b5f7e6..956f1f3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-09-13 Kan-Ru Chen + + * ecomplete.el (ecomplete-display-matches): Intercept key sequence from + terminal as well. + 2011-09-12 Lars Magne Ingebrigtsen * gnus.el (gnus-interactive-exit): Update defcustom spec. diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el index 6a47b11..737c0db 100644 --- a/lisp/ecomplete.el +++ b/lisp/ecomplete.el @@ -123,14 +123,15 @@ (message "%s" matches) nil) (setq highlight (ecomplete-highlight-match-line matches line)) - (while (not (memq (setq command (read-event highlight)) '(? return))) + (while (not (member (setq command (read-key-sequence-vector highlight)) + '([? ] [return] [?\r] [?\n] [?\C-g]))) (cond - ((eq command ?\M-n) + ((member command '([27 ?n] [?\M-n])) (setq line (min (1+ line) max-lines))) - ((eq command ?\M-p) + ((member command '([27 ?p] [?\M-p])) (setq line (max (1- line) 0)))) (setq highlight (ecomplete-highlight-match-line matches line))) - (when (eq command 'return) + (when (member command '([return] [?\r] [?\n])) (nth line (split-string matches "\n"))))))) (defun ecomplete-highlight-match-line (matches line) -- 1.7.5.4