Gnus development mailing list
 help / color / mirror / Atom feed
From: Kan-Ru Chen <kanru@kanru.info>
To: ding@gnus.org
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>, Kan-Ru Chen <kanru@kanru.info>
Subject: [PATCH] ecomplete.el: Intercept key sequence from terminal as well.
Date: Tue, 13 Sep 2011 20:43:29 +0800	[thread overview]
Message-ID: <1315917809-9724-1-git-send-email-kanru@kanru.info> (raw)

---
 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  <kanru@kanru.info>
+
+	* ecomplete.el (ecomplete-display-matches): Intercept key sequence from
+	terminal as well.
+
 2011-09-12  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* 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




             reply	other threads:[~2011-09-13 12:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 12:43 Kan-Ru Chen [this message]
2011-09-21 11:22 ` Kan-Ru Chen
2011-09-21 11:30 ` Julien Danjou
2011-09-21 13:12   ` Kan-Ru Chen
2011-09-21 18:14     ` Lars Magne Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315917809-9724-1-git-send-email-kanru@kanru.info \
    --to=kanru@kanru.info \
    --cc=ding@gnus.org \
    --cc=larsi@gnus.org \
    /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.
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 NNTP newsgroup(s).