Skip to content

Commit

Permalink
Retain compilation-arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
dgutov committed Jul 28, 2015
1 parent 451aa1d commit 03e969c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions inf-ruby.el
Expand Up @@ -539,17 +539,23 @@ Returns the selected completion or nil."
(defvar inf-ruby-orig-process-filter nil
"Original process filter before switching to `inf-ruby-mode'.")

(defvar inf-ruby-orig-compilation-arguments nil
"Original compilation arguments 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
interactive mode, i.e. hits a debugger breakpoint."
(interactive)
(setq buffer-read-only nil)
(buffer-enable-undo)
(let ((mode major-mode))
(let ((mode major-mode)
(arguments compilation-arguments))
(inf-ruby-mode)
(make-local-variable 'inf-ruby-orig-compilation-mode)
(setq inf-ruby-orig-compilation-mode mode))
(make-local-variable 'inf-ruby-orig-compilation-arguments)
(setq inf-ruby-orig-compilation-mode mode
inf-ruby-orig-compilation-arguments arguments))
(let ((proc (get-buffer-process (current-buffer))))
(when proc
(make-local-variable 'inf-ruby-orig-process-filter)
Expand All @@ -568,9 +574,11 @@ Otherwise, just toggle read-only status."
(if inf-ruby-orig-compilation-mode
(let ((orig-mode-line-process mode-line-process)
(proc (get-buffer-process (current-buffer)))
(arguments inf-ruby-orig-compilation-arguments)
(filter inf-ruby-orig-process-filter))
(funcall inf-ruby-orig-compilation-mode)
(setq mode-line-process orig-mode-line-process)
(setq mode-line-process orig-mode-line-process
compilation-arguments arguments)
(when proc
(set-process-filter proc filter)))
(toggle-read-only)))
Expand Down

0 comments on commit 03e969c

Please sign in to comment.