Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper handling of [return] and [tab] in ac-fallback-command #109

Closed
wants to merge 1 commit into from

Conversation

vspinu
Copy link
Contributor

@vspinu vspinu commented Jun 14, 2012

ac-completing-map defines actions on [return] and [tab]. Most of the modes
define RET and TAB keys as "\r" and "\t". Thus, when ac-fallback-command searches
for a command it fails to find it when it is bound to "\r" or "\t".

This patch corrects this issue.

ac-completing-map defines actions on [return] and [tab]. Most of the modes
define RET and TAB keys as "\r" and "\t". Thus when ac-fallback-command searches
for a command it fails to find it when it is bound to "\r" or "\t".

This patch corrects this issue.
@yyr
Copy link

yyr commented Jul 9, 2012

+1

@monsanto
Copy link
Contributor

This patch contains other commits other than fixing this issue. I'll have to cherry pick f6750b2.

@vspinu
Copy link
Contributor Author

vspinu commented Aug 29, 2012

Ah sorry, it's a mess up. Don't really understand what happen. So could
you cherry pick, or I can clean it up.

Christopher Monsanto notifications@github.com
on Wed, 29 Aug 2012 10:47:52 -0700 wrote:

This patch contains other commits other than fixing this issue. I'll have to cherry pick f6750b2.

Reply to this email directly or view it on GitHub:
#109 (comment)

@vspinu
Copy link
Contributor Author

vspinu commented Aug 29, 2012

Ah yes, I remember. I have merge the main branch into it. Let me try to clean it up.

@vspinu
Copy link
Contributor Author

vspinu commented Aug 29, 2012

Ok I have cleaned it. It contains only one commit. Please merge.

@m2ym
Copy link
Contributor

m2ym commented Sep 2, 2012

Your fix seems to be specific. How about this instead?

diff --git a/auto-complete.el b/auto-complete.el
index b31d430..7f7267d 100644
--- a/auto-complete.el
+++ b/auto-complete.el
@@ -1587,10 +1587,16 @@ that have been made before in this function."
            (string-match "self-insert-command" (symbol-name command))
            (string-match "electric" (symbol-name command)))))

+(defun ac-fallback-key-sequence ()
+  (setq unread-command-events
+        (append (this-single-command-raw-keys)
+                unread-command-events))
+  (read-key-sequence-vector ""))
+
 (defun ac-fallback-command (&optional except-command)
   (let* ((auto-complete-mode nil)
-         (keys (this-command-keys-vector))
-         (command (if keys (key-binding keys))))
+         (keys (ac-fallback-key-sequence))
+         (command (and keys (key-binding keys))))
     (when (and (commandp command)
                (not (eq command except-command)))
       (setq this-command command)

@ghost ghost assigned m2ym Sep 2, 2012
@vspinu
Copy link
Contributor Author

vspinu commented Sep 2, 2012

Yes, that seems to work. Thanks.

m2ym pushed a commit that referenced this pull request Sep 3, 2012
@m2ym
Copy link
Contributor

m2ym commented Sep 3, 2012

Fixed 2dbabec

@m2ym m2ym closed this Sep 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants