[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby c3049d5b0c 4/4: Allow ruby-switch-to-inf to switc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby c3049d5b0c 4/4: Allow ruby-switch-to-inf to switch to "from compilation" buffers as well |
Date: |
Mon, 6 May 2024 19:00:07 -0400 (EDT) |
branch: elpa/inf-ruby
commit c3049d5b0c84efa4cf61547e6dd7ad07921c5d7b
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>
Allow ruby-switch-to-inf to switch to "from compilation" buffers as well
#184
Also move the first detection step to a separate function and limit it
to buffers previously in compilation mode. Because otherwise breaking
the directory-based prioritization could be bad in other cases.
---
inf-ruby.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/inf-ruby.el b/inf-ruby.el
index 831d9febbd..3a0d6d9198 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -472,16 +472,20 @@ See variable `inf-ruby-buffers'."
;; Prioritize the first visible buffer,
;; e.g. for the case when it's inf-ruby
;; switched from compilation mode.
- (cl-find-if
- (lambda (buf)
- (provided-mode-derived-p
- (buffer-local-value 'major-mode buf)
- #'inf-ruby-mode))
- (mapcar #'window-buffer (window-list)))
+ (inf-ruby-fromcomp-buffer)
(inf-ruby-buffer)
inf-ruby-buffer)))
(error "No current process. See variable inf-ruby-buffers")))
+(defun inf-ruby-fromcomp-buffer ()
+ "Return the first visible compilation buffer in `inf-ruby-mode'."
+ (cl-find-if
+ (lambda (buf)
+ (and (buffer-local-value 'inf-ruby-orig-compilation-mode buf)
+ (provided-mode-derived-p (buffer-local-value 'major-mode buf)
+ 'inf-ruby-mode)))
+ (mapcar #'window-buffer (window-list))))
+
;; These commands are added to the inf-ruby-minor-mode keymap:
(defconst ruby-send-terminator "--inf-ruby-%x-%d-%d-%d--"
@@ -802,7 +806,7 @@ Optionally provide FILE and LINE metadata to Ruby."
With argument, positions cursor at end of buffer."
(interactive "P")
(let ((buffer (current-buffer))
- (inf-ruby-buffer* (or (inf-ruby-buffer) inf-ruby-buffer)))
+ (inf-ruby-buffer* (or (inf-ruby-fromcomp-buffer) (inf-ruby-buffer)
inf-ruby-buffer)))
(if inf-ruby-buffer*
(progn
(pop-to-buffer inf-ruby-buffer*)