[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby b12e05a6bb 068/265: Add funtion switching to comp
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby b12e05a6bb 068/265: Add funtion switching to compilation mode. |
Date: |
Sat, 9 Jul 2022 21:59:14 -0400 (EDT) |
branch: elpa/inf-ruby
commit b12e05a6bb837258630a874a2295137bd737c993
Author: Teruki Shigitani <ts-teruki.shigitani@mail.rakuten.com>
Commit: Teruki Shigitani <ts-teruki.shigitani@mail.rakuten.com>
Add funtion switching to compilation mode.
---
inf-ruby.el | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index ec928929ab..360ad1a859 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -70,6 +70,7 @@ graphical char in all other prompts.")
(define-key map (kbd "C-c C-l") 'ruby-load-file)
(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-switch-to-compilation)
map)
"Mode map for inf-ruby-mode")
@@ -160,12 +161,14 @@ Paragraphs are separated only by blank lines. # start
comments.
If you accidentally suspend your process, use \\[comint-continue-subjob]
to continue it."
(interactive)
- (comint-mode)
+ (let ((orig-mode-line-process mode-line-process))
+ (comint-mode)
+ (when orig-mode-line-process
+ (setq mode-line-process orig-mode-line-process)))
(setq comint-prompt-regexp inf-ruby-prompt-pattern)
(ruby-mode-variables)
(setq major-mode 'inf-ruby-mode)
(setq mode-name "Inf-Ruby")
- (setq mode-line-process '(":%s"))
(use-local-map inf-ruby-mode-map)
(add-hook 'comint-output-filter-functions 'inf-ruby-output-filter nil t)
(setq comint-get-old-input (function inf-ruby-get-old-input))
@@ -432,6 +435,9 @@ completion."
(call-interactively 'indent-for-tab-command)
(inf-ruby-complete command)))
+(defvar inf-ruby-orig-compilation-mode nil
+ "Original compilation mode before switching to `inf-ruby-mode'.")
+
(defun inf-ruby-switch-from-compilation ()
"Make the buffer writable and switch to `inf-ruby-mode'.
Recommended for use when the program being executed enters
@@ -439,14 +445,27 @@ interactive mode, i.e. hits a debugger breakpoint."
(interactive)
(setq buffer-read-only nil)
(buffer-enable-undo)
- (inf-ruby-mode)
+ (let ((mode major-mode))
+ (inf-ruby-mode)
+ (make-local-variable 'inf-ruby-orig-compilation-mode)
+ (setq inf-ruby-orig-compilation-mode mode))
(let ((proc (get-buffer-process (current-buffer))))
- (set-process-filter proc 'comint-output-filter)
+ (when proc
+ (set-process-filter proc 'comint-output-filter))
(when (looking-back inf-ruby-prompt-pattern (line-beginning-position))
(let ((line (match-string 0)))
(delete-region (match-beginning 0) (point))
(comint-output-filter proc line)))))
+(defun inf-ruby-switch-to-compilation ()
+ "Switch to compilation mode before switching to `inf-ruby-mode'."
+ (interactive)
+ (if inf-ruby-orig-compilation-mode
+ (let ((orig-mode-line-process mode-line-process))
+ (funcall inf-ruby-orig-compilation-mode)
+ (setq mode-line-process orig-mode-line-process))
+ (toggle-read-only)))
+
;;;###autoload
(defun inf-ruby-switch-setup ()
"Modify `rspec-compilation-mode' and `ruby-compilation-mode'
- [nongnu] elpa/inf-ruby 89147d2ab1 056/265: inf-ruby-completions: Get rid of the last semicolon, (continued)
- [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
- [nongnu] elpa/inf-ruby 530ac4f2fc 036/265: inf-ruby-mode: Modify the docstring, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 98fac55a80 049/265: Define inf-ruby-switch-from-compilation, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby fc1dffaeed 052/265: inf-ruby-prompt-format: Include debugger prompt, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby ebceb38165 058/265: inf-ruby-prompt-format: Fix not to match single operator chars, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby c749e54eee 063/265: Support Bond completion, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby b12e05a6bb 068/265: Add funtion switching to compilation mode.,
ELPA Syncer <=
- [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, 2022/07/09