[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby 13c0040b6e 009/265: Create non-indenting completi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby 13c0040b6e 009/265: Create non-indenting completion function 'inf-ruby-complete'. |
Date: |
Sat, 9 Jul 2022 21:59:09 -0400 (EDT) |
branch: elpa/inf-ruby
commit 13c0040b6e8646ce4c9b62f41afef73b38111731
Author: Cornelius Mika <cornelius.mika@gmail.com>
Commit: Cornelius Mika <cornelius.mika@gmail.com>
Create non-indenting completion function 'inf-ruby-complete'.
Retain 'inf-ruby-complete-or-tab' for use outside of inf-ruby buffers.
---
inf-ruby.el | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index 5852da808b..e0f10654bb 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -50,7 +50,7 @@
(let ((map (copy-keymap comint-mode-map)))
(define-key map (kbd "C-c C-l") 'inf-ruby-load-file)
(define-key map (kbd "C-x C-e") 'ruby-send-last-sexp)
- (define-key map (kbd "TAB") 'inf-ruby-complete-or-tab)
+ (define-key map (kbd "TAB") 'inf-ruby-complete)
map)
"*Mode map for inf-ruby-mode")
@@ -344,26 +344,34 @@ Then switch to the process buffer."
(set-process-filter proc comint-filt)
completions))
+(defun inf-ruby-completion-at-point ()
+ (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))
+
+(defun inf-ruby-complete (command)
+ "Complete the ruby code at point. Relies on the irb/completion
+Module used by readline when running irb through a terminal"
+ (interactive (list (inf-ruby-completion-at-point)))
+ (when command
+ (move-beginning-of-line 1)
+ (kill-line 1)
+ (insert command)))
+
(defun inf-ruby-complete-or-tab (&optional command)
"Either complete the ruby code at point or call
-`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 (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)))
+`indent-for-tab-command' if no completion is available."
+ (interactive (list (inf-ruby-completion-at-point)))
(if (not command)
(call-interactively 'indent-for-tab-command)
- (move-beginning-of-line 1)
- (kill-line 1)
- (insert command)))
+ (inf-ruby-complete command)))
;;;###autoload
(eval-after-load 'ruby-mode
- [nongnu] branch elpa/inf-ruby created (now 4ddf6b3889), ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby c9a24aee52 005/265: Bugfix: Exclude input to IRB from the completion result., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 6ad10268b3 007/265: Bugfix: Remove meaningless error check which causes a more severe error in the first place by not restoring the comint-filter., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 5e9912fadb 002/265: Allow sending code from non-file buffers., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 13c0040b6e 009/265: Create non-indenting completion function 'inf-ruby-complete'.,
ELPA Syncer <=
- [nongnu] elpa/inf-ruby b5aa6c51fe 027/265: [Refactor] Use defsubst for 'inf-ruby-fix-completions-on-windows', ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby fe0547b16d 032/265: [Refactor] Use 'kbd' macro for key bindings, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 60f9cfa181 001/265: Initial revision., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby c63972e2de 014/265: Package header: Don't require ruby-mode., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 5fa2849dd0 028/265: Store non-whitespace input in the REPL history, regardless of character length., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 89147d2ab1 056/265: inf-ruby-completions: Get rid of the last semicolon, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby c08bb93df2 040/265: inf-ruby-load-file is not defined, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 90762203f3 055/265: inf-ruby-switch-from-compilation: Change the process filter, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 4873a66a4d 054/265: inf-ruby-completions: Use 'then' instead of semicolons, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 7fc1e32ae7 050/265: Bump the version, ELPA Syncer, 2022/07/09