[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-ruby 1f69ae4baf 157/265: Automatically entering inf-ru
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-ruby 1f69ae4baf 157/265: Automatically entering inf-ruby on pry |
Date: |
Sat, 9 Jul 2022 21:59:22 -0400 (EDT) |
branch: elpa/inf-ruby
commit 1f69ae4baf9eb0d59c8d3a498e7cdbd2972a5fa3
Author: Daniel Luna <dancluna@gmail.com>
Commit: Daniel Luna <dancluna@gmail.com>
Automatically entering inf-ruby on pry
---
README.md | 4 ++--
inf-ruby.el | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index bf1f4ede86..21a92732c9 100644
--- a/README.md
+++ b/README.md
@@ -60,10 +60,10 @@ automatically.
Additionally, consider adding
```lisp
-(add-hook 'after-init-hook 'inf-ruby-switch-setup)
+(add-hook 'compilation-filter-hook 'inf-ruby-auto-enter)
```
-to your init file to easily switch from common Ruby compilation
+to your init file to automatically switch from common Ruby compilation
modes to interact with a debugger.
### Emacs Prelude
diff --git a/inf-ruby.el b/inf-ruby.el
index 06eeb0af4b..1f632010dc 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -634,6 +634,9 @@ keymaps to bind `inf-ruby-switch-from-compilation' to `ะก-x
C-q'."
one of the predicates matches, then calls `inf-ruby-console-NAME',
passing it the found directory.")
+(defvar inf-ruby-breakpoint-pattern "\\[1\\] pry(" "Pattern to check if the
+current line indicates the current compilation mode entered a breakpoint")
+
(defun inf-ruby-console-match (dir)
"Find matching console command for DIR, if any."
(catch 'type
@@ -731,6 +734,13 @@ Gemfile, it should use the `gemspec' instruction."
(let ((default-directory (file-name-as-directory dir)))
(run-ruby "bundle exec racksh" "racksh")))
+(defun inf-ruby-auto-enter ()
+ "Automatically enters inf-ruby mode when it sees a breakpoint-indicating
pattern."
+ (when (member major-mode '(rspec-compilation-mode ruby-compilation-mode
projectile-rails-server-mode))
+ (beginning-of-line)
+ (when (re-search-forward inf-ruby-breakpoint-pattern (line-end-position) t)
+ (inf-ruby-switch-from-compilation))))
+
;;;###autoload
(defun inf-ruby-console-default (dir)
"Run custom console.rb, Pry, or bundle console, in DIR."
- [nongnu] elpa/inf-ruby f232f780ec 119/265: Link to the issue 51, (continued)
- [nongnu] elpa/inf-ruby f232f780ec 119/265: Link to the issue 51, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby d4d2451d16 111/265: Apply `defcustom` fixes, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby fd84092271 099/265: Merge pull request #43 from hrvladev/fix-readme-typo, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 14ca8ddda5 098/265: Fix code indication in the readme, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 8979f51c53 126/265: Start console.rb through bundler., ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby db0bdf3f38 107/265: Merge pull request #50 from avsej/master, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 2cebc69ecd 095/265: Remove some outdated code, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 6c00b018bf 142/265: inf-ruby-console-rails-p: Use a stricter check, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby d130ede56a 133/265: Define a proper completion function, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby b31b7d3061 137/265: inf-ruby-console-patterns-alist: Detect Rails by the presence of bin/rails, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 1f69ae4baf 157/265: Automatically entering inf-ruby on pry,
ELPA Syncer <=
- [nongnu] elpa/inf-ruby 03e969c89a 146/265: Retain compilation-arguments, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 7f8f32e7d0 154/265: Use 'point-min instead of the hardcoded value, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 45af13a729 172/265: Recognize byebug prompt, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 8b198d01e9 180/265: Merge pull request #93 from sideshowcoder/zeus-console-support, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby c14a68d164 207/265: Specify environment correctly, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 5ae6149a15 211/265: Merge pull request #110 from ppiotrowicz/master, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby a986a1a8c6 260/265: Fix broken behaviour on load-current-ruby-file fn, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby dbf4386bac 264/265: Use a more uniform style, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby 1940f90fde 017/265: Version 2.2.3, ELPA Syncer, 2022/07/09
- [nongnu] elpa/inf-ruby b45b057006 044/265: Fix syntax error highlighting, ELPA Syncer, 2022/07/09