[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby dc7df6541e 091/265: inf-ruby-completions: Make sa
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby dc7df6541e 091/265: inf-ruby-completions: Make safer |
Date: |
Sat, 9 Jul 2022 21:59:16 -0400 (EDT) |
branch: elpa/inf-ruby
commit dc7df6541efa1a1ff6bc456cc9d79e12384caeed
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
inf-ruby-completions: Make safer
#35
---
inf-ruby.el | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index af5ac02d3b..798f8a415e 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -414,26 +414,30 @@ subprocess echoes input."
(line (buffer-substring (save-excursion (beginning-of-thing 'line))
(point)))
(comint-filt (process-filter proc))
- (kept "") completions)
+ (kept "") completions
+ ;; Guard against running completions in parallel:
+ inf-ruby-at-top-level-prompt-p)
(set-process-filter proc (lambda (proc string) (setq kept (concat kept
string))))
- (process-send-string
- proc
- (format (concat "if defined?(Pry.config) then "
- "completor = Pry.config.completer"
- ".build_completion_proc(binding, defined?(_pry_) ? _pry_
: Pry.new)"
- " elsif defined?(Bond.agent) && Bond.started? then "
- "completor = Bond.agent"
- " elsif defined?(IRB::InputCompletor::CompletionProc)
then "
- "completor = IRB::InputCompletor::CompletionProc "
- "end and "
- "puts completor.call('%s', '%s').compact\n")
- (ruby-escape-single-quoted expr)
- (ruby-escape-single-quoted line)))
- (while (and (not (string-match inf-ruby-prompt-pattern kept))
- (accept-process-output proc 2)))
- (setq completions (butlast (split-string kept "\r?\n") 2))
- (setq completions (inf-ruby-fix-completions-on-windows completions))
- (set-process-filter proc comint-filt)
+ (unwind-protect
+ (progn
+ (process-send-string
+ proc
+ (format (concat "if defined?(Pry.config) then "
+ "completor = Pry.config.completer"
+ ".build_completion_proc(binding, defined?(_pry_) ?
_pry_ : Pry.new)"
+ " elsif defined?(Bond.agent) && Bond.started? then "
+ "completor = Bond.agent"
+ " elsif
defined?(IRB::InputCompletor::CompletionProc) then "
+ "completor = IRB::InputCompletor::CompletionProc "
+ "end and "
+ "puts completor.call('%s', '%s').compact\n")
+ (ruby-escape-single-quoted expr)
+ (ruby-escape-single-quoted line)))
+ (while (and (not (string-match inf-ruby-prompt-pattern kept))
+ (accept-process-output proc 2)))
+ (setq completions (butlast (split-string kept "\r?\n") 2))
+ (setq completions (inf-ruby-fix-completions-on-windows completions)))
+ (set-process-filter proc comint-filt))
completions))
(defconst inf-ruby-ruby-expr-break-chars " \t\n\"\'`><,;|&{(")
- [nongnu] elpa/inf-ruby 771c7473b9 039/265: Pass --prompt default to ruby and jruby, (continued)
- [nongnu] elpa/inf-ruby 771c7473b9 039/265: Pass --prompt default to ruby and jruby, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 6f4e68bb1c 043/265: Set comint-process-echoes on Windows, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 928a5dfd73 059/265: inf-ruby-switch-from-compilation: Call `comint-output-filter` on current line, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 6a45c1451a 069/265: inf-ruby-switch-to-compilation: Rename to -maybe-, tweak the docstring, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 350b12fea3 062/265: inf-ruby-prompt-format: Minor cleanup, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby db01e3dd13 092/265: Fix send-region with pure-Pry repl, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby e3335232ce 081/265: Add missing code section to comment front-matter, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 87a5fd3038 074/265: Make inf-ruby-minor-mode keymap visible when doing C-h f/C-h m, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 422cc1be93 093/265: Fix #35, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 20585d3983 108/265: Use file-name-as-directory to add a trailing slash, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby dc7df6541e 091/265: inf-ruby-completions: Make safer,
ELPA Syncer <=
- [nongnu] elpa/inf-ruby 96c48e0270 084/265: Save inf-ruby-orig-process-filter value locally before switching mode, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby e8cd8c4a28 076/265: Touch up README, docstrings and comments, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 24c08fca2a 152/265: Fix the previous commit, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 171c4e9e38 139/265: Update subheaders, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 96408b9cad 149/265: Update MELPA URL, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby c353603f1f 140/265: Merge pull request #68 from Trevoke/patch-1, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 0885009c11 012/265: Version 2.2, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 37bae51429 015/265: Replace pointless setfs with setqs., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 80a1c2c3d2 031/265: Fix commit 'Store non-whitespace input in the REPL history, ...', ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 0b27477d11 166/265: Tweak auto-enter and auto-exit to work better (or at all), ELPA Syncer, 2022/07/09