emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-ruby 73e2142a99 194/265: Add new option inf-ruby-conso


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby 73e2142a99 194/265: Add new option inf-ruby-console-environment
Date: Sat, 9 Jul 2022 21:59:25 -0400 (EDT)

branch: elpa/inf-ruby
commit 73e2142a99e3161768bc746d478a860456ac8f44
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Add new option inf-ruby-console-environment
    
    Closes #94.
---
 inf-ruby.el | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index 2962b84398..d21450e2b6 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -99,6 +99,16 @@ Also see the description of `ielm-prompt-read-only'."
                            inf-ruby-implementations))
   :group 'inf-ruby)
 
+(defcustom inf-ruby-console-environment 'ask
+  "Envronment to use for the `inf-ruby-console-*' commands.
+If the value is not a string, ask the user to choose from the
+available ones.  Otherwise, just use the value.
+
+Currently only affects `inf-ruby-console-rails'."
+  :type '(choice
+          (const ask :tag "Ask the user")
+          (string :tag "Environment name")))
+
 (defconst inf-ruby-prompt-format
   (concat
    (mapconcat
@@ -750,9 +760,7 @@ automatically."
   "Run Rails console in DIR."
   (interactive (list (inf-ruby-console-read-directory 'rails)))
   (let* ((default-directory (file-name-as-directory dir))
-         (envs (inf-ruby-console-rails-envs))
-         (env (completing-read "Rails environment: " envs nil t
-                               nil nil (car (member "development" envs))))
+         (env (inf-ruby-console-rails-env))
          (with-bundler (file-exists-p "Gemfile")))
     (inf-ruby-console-run
      (concat (when with-bundler "bundle exec ")
@@ -760,6 +768,15 @@ automatically."
              env)
      "rails")))
 
+(defun inf-ruby-console-rails-env ()
+  (if (stringp inf-ruby-console-environment)
+      inf-ruby-console-environment
+    (let ((envs (inf-ruby-console-rails-envs)))
+      (completing-read "Rails environment: "
+                       envs
+                       nil t
+                       nil nil (car (member "development" envs))))))
+
 (defun inf-ruby-console-rails-envs ()
   (let ((files (file-expand-wildcards "config/environments/*.rb")))
     (if (null files)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]