From 06b6e3b02959a484d70080965525525166aa1605 Mon Sep 17 00:00:00 2001 From: abicky Date: Sun, 1 Jun 2014 18:03:53 +0900 Subject: [PATCH] Improve TAB completion --- .gitignore | 3 +++ inf-ruby.el | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0431f89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +inf-ruby-autoloads.el +*.elc +*~ diff --git a/inf-ruby.el b/inf-ruby.el index 94a1f5d..e6007e1 100755 --- a/inf-ruby.el +++ b/inf-ruby.el @@ -520,9 +520,11 @@ Returns the selected completion or nil." Uses the first one available of Pry, Bond and the default IRB completion." (interactive) - (let ((replacement (inf-ruby-completion-at-point))) - (when replacement - (inf-ruby-complete-replace-expr replacement)))) + (when (comint-after-pmark-p) + (let* ((bounds (inf-ruby-completion-bounds-of-expr-at-point)) + (expr (buffer-substring (car bounds) (cdr bounds))) + (completions (inf-ruby-completions expr))) + (completion-in-region (car bounds) (cdr bounds) completions)))) (defun inf-ruby-complete-replace-expr (str) "Replace expression at point with STR."