Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] ecomplete.el: Intercept key sequence from terminal as well.
@ 2011-09-13 12:43 Kan-Ru Chen
  2011-09-21 11:22 ` Kan-Ru Chen
  2011-09-21 11:30 ` Julien Danjou
  0 siblings, 2 replies; 5+ messages in thread
From: Kan-Ru Chen @ 2011-09-13 12:43 UTC (permalink / raw)
  To: ding; +Cc: Lars Magne Ingebrigtsen, Kan-Ru Chen

---
 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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ecomplete.el: Intercept key sequence from terminal as well.
  2011-09-13 12:43 [PATCH] ecomplete.el: Intercept key sequence from terminal as well Kan-Ru Chen
@ 2011-09-21 11:22 ` Kan-Ru Chen
  2011-09-21 11:30 ` Julien Danjou
  1 sibling, 0 replies; 5+ messages in thread
From: Kan-Ru Chen @ 2011-09-21 11:22 UTC (permalink / raw)
  To: ding

ping?

Kan-Ru Chen <kanru@kanru.info> writes:

> ---
>  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)

-- 
Kanru



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ecomplete.el: Intercept key sequence from terminal as well.
  2011-09-13 12:43 [PATCH] ecomplete.el: Intercept key sequence from terminal as well Kan-Ru Chen
  2011-09-21 11:22 ` Kan-Ru Chen
@ 2011-09-21 11:30 ` Julien Danjou
  2011-09-21 13:12   ` Kan-Ru Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Julien Danjou @ 2011-09-21 11:30 UTC (permalink / raw)
  To: Kan-Ru Chen; +Cc: ding, Lars Magne Ingebrigtsen

[-- Attachment #1: Type: text/plain, Size: 74 bytes --]

On Tue, Sep 13 2011, Kan-Ru Chen wrote:

Merged.

-- 
Julien Danjou

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ecomplete.el: Intercept key sequence from terminal as well.
  2011-09-21 11:30 ` Julien Danjou
@ 2011-09-21 13:12   ` Kan-Ru Chen
  2011-09-21 18:14     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Kan-Ru Chen @ 2011-09-21 13:12 UTC (permalink / raw)
  To: ding; +Cc: Lars Magne Ingebrigtsen

Julien Danjou <julien@danjou.info> writes:

> On Tue, Sep 13 2011, Kan-Ru Chen wrote:
>
> Merged.

D'oh! I got a buildbot compile failed report and realized
`read-key-sequence-vector' does not exist in XEmacs and
`read-key-sequence' is so different between the variants that origin
code wouldn't work in XEmacs either.

-- 
Kanru



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ecomplete.el: Intercept key sequence from terminal as well.
  2011-09-21 13:12   ` Kan-Ru Chen
@ 2011-09-21 18:14     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-21 18:14 UTC (permalink / raw)
  To: Kan-Ru Chen; +Cc: ding

Kan-Ru Chen <kanru@kanru.info> writes:

> D'oh! I got a buildbot compile failed report and realized
> `read-key-sequence-vector' does not exist in XEmacs and
> `read-key-sequence' is so different between the variants that origin
> code wouldn't work in XEmacs either.

I reverted the code for now, but if you could come up with a version
that would work on both Emacs versions, that would be nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-21 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-13 12:43 [PATCH] ecomplete.el: Intercept key sequence from terminal as well Kan-Ru Chen
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

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).