[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby 2d65630b7d 100/265: Introduce `ruby-switch-to-las
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby 2d65630b7d 100/265: Introduce `ruby-switch-to-last-ruby-buffer' |
Date: |
Sat, 9 Jul 2022 21:59:17 -0400 (EDT) |
branch: elpa/inf-ruby
commit 2d65630b7d4bed387d131cde0d4649a68a419a17
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Introduce `ruby-switch-to-last-ruby-buffer'
Closes #44
---
inf-ruby.el | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index d26c76843d..bc478bee9f 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -103,6 +103,7 @@ graphical char in all other prompts.")
(define-key map (kbd "C-x C-e") 'ruby-send-last-sexp)
(define-key map (kbd "TAB") 'inf-ruby-complete)
(define-key map (kbd "C-x C-q") 'inf-ruby-maybe-switch-to-compilation)
+ (define-key map (kbd "C-c C-z") 'ruby-switch-to-last-ruby-buffer)
map)
"Mode map for `inf-ruby-mode'.")
@@ -284,12 +285,14 @@ in `inf-ruby-implementations'.
(if (not (comint-check-proc inf-ruby-buffer))
(let ((commandlist (split-string-and-unquote command))
+ (buffer (current-buffer))
(process-environment process-environment))
;; http://debbugs.gnu.org/15775
(setenv "PAGER" (executable-find "cat"))
(set-buffer (apply 'make-comint name (car commandlist)
nil (cdr commandlist)))
- (inf-ruby-mode)))
+ (inf-ruby-mode)
+ (ruby-remember-ruby-buffer buffer)))
(pop-to-buffer (setq inf-ruby-buffer (format "*%s*" name))))
(defun inf-ruby-proc ()
@@ -363,17 +366,34 @@ Must not contain ruby meta characters.")
(ruby-beginning-of-block)
(ruby-send-region (point) end))))
+(defvar ruby-last-ruby-buffer nil
+ "The last buffer we switched to `inf-ruby' from.")
+
+(defun ruby-remember-ruby-buffer (buffer)
+ (setq ruby-last-ruby-buffer buffer))
+
(defun ruby-switch-to-inf (eob-p)
"Switch to the ruby process buffer.
With argument, positions cursor at end of buffer."
(interactive "P")
- (if (and inf-ruby-buffer (get-buffer inf-ruby-buffer))
- (pop-to-buffer inf-ruby-buffer)
- (error "No current process buffer, see variable inf-ruby-buffer"))
+ (let ((buffer (current-buffer)))
+ (if (and inf-ruby-buffer (get-buffer inf-ruby-buffer))
+ (progn
+ (pop-to-buffer inf-ruby-buffer)
+ (ruby-remember-ruby-buffer buffer))
+ (error "No current process buffer, see variable inf-ruby-buffer")))
(cond (eob-p
(push-mark)
(goto-char (point-max)))))
+(defun ruby-switch-to-last-ruby-buffer ()
+ "Switch back to the last Ruby buffer."
+ (interactive)
+ (if (and ruby-last-ruby-buffer
+ (buffer-live-p ruby-last-ruby-buffer))
+ (pop-to-buffer ruby-last-ruby-buffer)
+ (message "Don't know the original Ruby buffer")))
+
(defun ruby-send-region-and-go (start end)
"Send the current region to the inferior Ruby process.
Then switch to the process buffer."
@@ -501,7 +521,7 @@ completion."
"Original compilation mode before switching to `inf-ruby-mode'.")
(defvar inf-ruby-orig-process-filter nil
- "Original process filter before switching to `inf-ruby-mode`.")
+ "Original process filter before switching to `inf-ruby-mode'.")
(defun inf-ruby-switch-from-compilation ()
"Make the buffer writable and switch to `inf-ruby-mode'.
- [nongnu] elpa/inf-ruby b12e05a6bb 068/265: Add funtion switching to compilation mode., (continued)
- [nongnu] elpa/inf-ruby b12e05a6bb 068/265: Add funtion switching to compilation mode., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 8fe1c3d80a 061/265: Bump the version, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby a6daf44f67 067/265: Changed 'bundle exec irb' to 'bundle console', ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby b767d52caf 066/265: inf-ruby-console-gem: Pass -r arguments in the bundle exec case, too, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby d18e63e44e 102/265: Not real need for the third argument, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 3a68ee2bb1 086/265: Touch up docstrings, change the signatures of inf-ruby-complete[-or-tab], ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 9f0cea55f0 073/265: Extend usage section, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 870e27f1ee 125/265: Detect pry gem in case to run bundle exec pry., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 6c85470ce4 110/265: inf-ruby-implementations: use '--noreadline', ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 524a86c90b 089/265: Set PAGER locally unless it's set, fixes #33, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 2d65630b7d 100/265: Introduce `ruby-switch-to-last-ruby-buffer',
ELPA Syncer <=
- [nongnu] elpa/inf-ruby 2cb21b9f58 090/265: Make PAGER override unconditional, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 23929579a6 124/265: Merge pull request #57 from bbatsov/compilation-warnings, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby e4cf0593da 116/265: inf-ruby-console-gem: require the main file if it exists, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 27acc75257 113/265: inf-ruby-console-rails: prompt for the environment, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 0697315485 109/265: Merge pull request #52 from abicky/support-dir-without-traiing-slash, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 451aa1d858 145/265: Merge pull request #71 from jasonko/master, ELPA Syncer, 2022/07/09
- [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