[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby d39ea0bd59 212/265: Use a more common idea of pre
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby d39ea0bd59 212/265: Use a more common idea of prefix |
Date: |
Sat, 9 Jul 2022 21:59:27 -0400 (EDT) |
branch: elpa/inf-ruby
commit d39ea0bd59e5f62eb92a051c1ab3d7a0f896ae0c
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Use a more common idea of prefix
Spanning from the last dot, not from the beginning of expression.
To work better with company-minimum-prefix-length,
https://github.com/dgutov/robe/issues/96#issuecomment-359110539.
---
inf-ruby.el | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index 9d3d8a0d7b..920254ac0c 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -566,12 +566,14 @@ Then switch to the process buffer."
(replace-regexp-in-string "\n" "\\\\n"
(replace-regexp-in-string "\\\\" "\\\\\\\\" str))))
-(defun inf-ruby-completions (expr)
+(defun inf-ruby-completions (prefix)
"Return a list of completions for the Ruby expression starting with EXPR."
(let* ((proc (inf-ruby-proc))
(line (buffer-substring (save-excursion (move-beginning-of-line 1)
(point))
(point)))
+ (expr (inf-ruby-completion-expr-at-point))
+ (prefix-offset (- (length expr) (length prefix)))
(comint-filt (process-filter proc))
(kept "") completions
;; Guard against running completions in parallel:
@@ -613,10 +615,19 @@ Then switch to the process buffer."
(when (and completions (string= (concat (car completions) "\n")
completion-snippet))
(setq completions (cdr completions))))
(set-process-filter proc comint-filt)))
- completions))
+ (mapcar
+ (lambda (str)
+ (substring str prefix-offset))
+ completions)))
(defconst inf-ruby-ruby-expr-break-chars " \t\n\"\'`><,;|&{(")
+(defun inf-ruby-completion-bounds-of-prefix ()
+ "Return bounds of expression at point to complete."
+ (let ((inf-ruby-ruby-expr-break-chars
+ (concat inf-ruby-ruby-expr-break-chars ".")))
+ (inf-ruby-completion-bounds-of-expr-at-point)))
+
(defun inf-ruby-completion-bounds-of-expr-at-point ()
"Return bounds of expression at point to complete."
(when (not (memq (char-syntax (following-char)) '(?w ?_)))
@@ -634,7 +645,7 @@ Then switch to the process buffer."
(defun inf-ruby-completion-at-point ()
"Retrieve the list of completions and prompt the user.
Returns the selected completion or nil."
- (let ((bounds (inf-ruby-completion-bounds-of-expr-at-point)))
+ (let ((bounds (inf-ruby-completion-bounds-of-prefix)))
(when bounds
(list (car bounds) (cdr bounds)
(when inf-ruby-at-top-level-prompt-p
- [nongnu] elpa/inf-ruby 1a5aebea0d 213/265: Bring back interactive run-ruby, (continued)
- [nongnu] elpa/inf-ruby 1a5aebea0d 213/265: Bring back interactive run-ruby, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby fe1ea9925c 226/265: Restore original compilation-error-regexp-alist, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 9bfbce42be 241/265: Untabify and reformat the new code a little, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 92d5d122fa 245/265: Use 'bundle exec' in nomultiline check when needed, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby bcdb97983c 257/265: Merge pull request #154 from tunnes/feature-create-load-current-ruby-file, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 5143c84f91 189/265: inf-ruby-proc: Fall back to inf-ruby-buffer, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 5b24985b0e 135/265: Check IRB is defined before using it, fixes #64, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby f908b1f506 136/265: Merge pull request #65 from iqbalansari/master, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 0af69257a4 138/265: Clarify the "usage" section, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 12d1d35f73 153/265: Add ruby-send-buffer function, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby d39ea0bd59 212/265: Use a more common idea of prefix,
ELPA Syncer <=
- [nongnu] elpa/inf-ruby 227a80fc52 176/265: Correct regexp, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby ca10d72e0c 220/265: Merge pull request #118 from marsam/master, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby e4ae089218 228/265: inf-ruby-console-gem: Support new IRB, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby a5b471efc0 233/265: Update document for support ruby 2.7.1, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 067dcba3b0 234/265: Merge pull request #135 from zw963/master, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 965df80555 235/265: Copy edits, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby b0124578db 238/265: Copy edits, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 7593d0f355 239/265: Change ruby-send-region to send any class and module lines that enlose the definition. Also throw error it not called within a definition, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 16c2acb458 250/265: Apply code review - use original Cider's face definition, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 2fae1a8ba9 248/265: Change 'C-x C-e' binding to use the new command, ELPA Syncer, 2022/07/09