[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby 7593d0f355 239/265: Change ruby-send-region to se
From: |
ELPA Syncer |
Subject: |
[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 |
Date: |
Sat, 9 Jul 2022 21:59:29 -0400 (EDT) |
branch: elpa/inf-ruby
commit 7593d0f355d9f0dc5a4575453bfed2b13a3d58c9
Author: Richard Sharman <rsharman@pobox.com>
Commit: Richard Sharman <rsharman@pobox.com>
Change ruby-send-region to send any class and module lines that enlose the
definition. Also throw error it not called within a definition
---
inf-ruby.el | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index 28233e39d6..de63949014 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -450,7 +450,7 @@ Must not contain ruby meta characters.")
(defconst ruby-eval-separator "")
-(defun ruby-send-region (start end &optional print)
+(defun ruby-send-region (start end &optional print prefix suffix line-adjust)
"Send the current region to the inferior Ruby process."
(interactive "r\nP")
(let (term (file (or buffer-file-name (buffer-name))) line)
@@ -470,10 +470,16 @@ Must not contain ruby meta characters.")
(goto-char m)
(insert ruby-eval-separator "\n")
(set-marker m (point))))
+ (if line-adjust
+ (setq line (+ line line-adjust)))
(comint-send-string (inf-ruby-proc) (format "eval <<'%s', %s, %S, %d\n"
term inf-ruby-eval-binding
file line))
+ (if prefix
+ (comint-send-string (inf-ruby-proc) prefix))
(comint-send-region (inf-ruby-proc) start end)
+ (if suffix
+ (comint-send-string (inf-ruby-proc) suffix))
(comint-send-string (inf-ruby-proc) (concat "\n" term "\n"))
(when print (ruby-print-result))))
@@ -502,10 +508,26 @@ Must not contain ruby meta characters.")
"Send the current definition to the inferior Ruby process."
(interactive)
(save-excursion
- (end-of-defun)
- (let ((end (point)))
- (ruby-beginning-of-defun)
- (ruby-send-region (point) end))))
+ (let ((orig-start (point))
+ (adjust-lineno 0)
+ prefix suffix defun-start)
+ (save-excursion
+ (end-of-line)
+ (ruby-beginning-of-defun)
+ (setq defun-start (point))
+ (unless (ruby-block-contains-point orig-start)
+ (error "point is not within a definition"))
+ (while (and (ignore-errors (backward-up-list) t)
+ (looking-at "\\s-*\\(class\\|module\\)\\s-"))
+ (let ((line (buffer-substring-no-properties
(line-beginning-position)(1+ (line-end-position)))))
+ (if prefix
+ (setq prefix (concat line prefix)
+ suffix (concat suffix "end\n"))
+ (setq prefix line
+ suffix "end\n"))
+ (setq adjust-lineno (1- adjust-lineno)))))
+ (end-of-defun)
+ (ruby-send-region defun-start (point) nil prefix suffix adjust-lineno))))
(defun ruby-send-last-sexp (&optional print)
"Send the previous sexp to the inferior Ruby process."
- [nongnu] elpa/inf-ruby 0af69257a4 138/265: Clarify the "usage" section, (continued)
- [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, 2022/07/09
- [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 <=
- [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
- [nongnu] elpa/inf-ruby 871158bcad 255/265: Merge pull request #153 from tunnes/feature-create-eval-overlay, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 7ed2b03c95 258/265: Check specifically than IRB.conf is defined, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 8894867e9d 263/265: Fix #159 by bringing back --noreadline, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 51ba99f6be 186/265: Proper heading for hooks, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby ec70d7f0e9 187/265: inf-ruby-buffer: Fix "wrong-type-argument stringp nil" outside of any project, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby e05cc84738 196/265: Add menu for inf-ruby-minor-mode, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 5d7397ddd9 206/265: Add Hanami console launcher, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 2fa228f756 210/265: Add minitest-compilation-mode to Ruby compilation modes, ELPA Syncer, 2022/07/09