[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby 06e2b1e29e 008/265: Bugfix: Complete only when po
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby 06e2b1e29e 008/265: Bugfix: Complete only when point is at a top-level prompt. |
Date: |
Sat, 9 Jul 2022 21:59:09 -0400 (EDT) |
branch: elpa/inf-ruby
commit 06e2b1e29e11814ab39b6f3e2399212fa2e8a458
Author: Cornelius Mika <cornelius.mika@gmail.com>
Commit: Cornelius Mika <cornelius.mika@gmail.com>
Bugfix: Complete only when point is at a top-level prompt.
With the current Inf-Ruby/IRB design completion doesn't work at
secondary prompts that follow unclosed quotes or brackets.
---
inf-ruby.el | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index 45878c1e1c..5852da808b 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -74,6 +74,8 @@ Caches the last pair used in the last ruby-load-file command.
Used for determining the default in the
next one.")
+(defvar inf-ruby-at-top-level-prompt-p t)
+
(defconst inf-ruby-error-regexp-alist
'(("SyntaxError: compile error\n^\\([^\(].*\\):\\([1-9][0-9]*\\):" 1 2)
("^\tfrom \\([^\(].*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?$" 1 2)))
@@ -136,6 +138,7 @@ to continue it."
(setq mode-line-process '(":%s"))
(use-local-map inf-ruby-mode-map)
(setq comint-input-filter (function inf-ruby-input-filter))
+ (add-to-list 'comint-output-filter-functions 'inf-ruby-output-filter)
(setq comint-get-old-input (function inf-ruby-get-old-input))
(make-local-variable 'compilation-error-regexp-alist)
(setq compilation-error-regexp-alist inf-ruby-error-regexp-alist)
@@ -150,6 +153,12 @@ Defaults to a regexp ignoring all inputs of 0, 1, or 2
letters.")
"Don't save anything matching inf-ruby-filter-regexp"
(not (string-match inf-ruby-filter-regexp str)))
+(defun inf-ruby-output-filter (output)
+ "Check if the current prompt is a top-level prompt"
+ (setq inf-ruby-at-top-level-prompt-p
+ (string-match inf-ruby-prompt-pattern
+ (car (last (split-string output "\n"))))))
+
;; adapted from replace-in-string in XEmacs (subr.el)
(defun inf-ruby-remove-in-string (str regexp)
"Remove all matches in STR for REGEXP and returns the new string."
@@ -340,12 +349,16 @@ Then switch to the process buffer."
`indent-for-tab-command' if no completion is available. Relies
on the irb/completion Module used by readline when running irb
through a terminal."
- (interactive (list (let* ((curr (thing-at-point 'line))
- (completions (inf-ruby-completions curr)))
- (case (length completions)
- (0 nil)
- (1 (car completions))
- (t (completing-read "possible completions: "
completions nil 'confirm-only curr))))))
+ (interactive (list (if inf-ruby-at-top-level-prompt-p
+ (let* ((curr (thing-at-point 'line))
+ (completions (inf-ruby-completions curr)))
+ (case (length completions)
+ (0 nil)
+ (1 (car completions))
+ (t (completing-read "possible completions: "
+ completions nil t curr))))
+ (message "Completion aborted: Not at a top-level
prompt")
+ nil)))
(if (not command)
(call-interactively 'indent-for-tab-command)
(move-beginning-of-line 1)
- [nongnu] elpa/inf-ruby 46917f463c 151/265: Integrate with projectile-rails-server-mode, (continued)
- [nongnu] elpa/inf-ruby 46917f463c 151/265: Integrate with projectile-rails-server-mode, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 4962bb076e 141/265: inf-ruby-console-patterns-alist: Accept predicate function in cars, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby c59d7d0a23 134/265: inf-ruby-console-default: Prioritize console.rb if it exists, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby e91b349e4f 168/265: Hook up inf-ruby-auto-exit inside inf-ruby-auto-enter, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 106972ded1 165/265: Touch up docstrings and rename MODE-VAR to MODE, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 0ed06255ec 179/265: Allow running multiple ruby processes, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 536a68528c 184/265: Make ruby-last-ruby-buffer buffer-local, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby d1e6e9e669 003/265: Bugfix: Escape the completion seed., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby ed768ce413 004/265: Evaluate code sent via 'ruby-send-region' in the same binding as the REPL., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 68a7ad32fa 006/265: Bugfix: Don't stall Emacs when there is no valid completion output., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 06e2b1e29e 008/265: Bugfix: Complete only when point is at a top-level prompt.,
ELPA Syncer <=
- [nongnu] elpa/inf-ruby ec0d30ad19 019/265: Merge pull request #5 from lewang/quote_fix, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby f52d33ec43 016/265: Transform an unneded case statement into an if statement., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 28c24e3e70 021/265: Merge pull request #7 from lewang/patch-1, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby f2e7cc8313 025/265: Restrict a Windows-specific fix to be applied only on Windows platforms., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 415eb2dfd8 018/265: allow quoted parameters to run-ruby, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby fd0eccaedf 020/265: use `eval-after' to bind keys instead of hooking, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 910658e1f3 029/265: Use 'ruby-backward-sexp' instead of 'backward-sexp', ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 4f4f0ccdf7 026/265: Version 2.2.4, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 032d3f024e 024/265: Merge pull request #9 from DrJKL/master, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 505b3cd216 023/265: Changed the manual installation comments to reflect the change from inf-ruby-keys to inf-ruby-setup-keybindings, ELPA Syncer, 2022/07/09