Skip to content

Add custom variable to specify a wrapper for the determined commands to launch a console - #190

Merged
dgutov merged 2 commits into
nonsequitur:masterfrom
someonewithpc:wrapper-command
Dec 16, 2024
Merged

dgutov merged 2 commits into
nonsequitur:masterfrom
someonewithpc:wrapper-command

Conversation

@someonewithpc

Copy link
Copy Markdown
Contributor

This allows running the console inside a Docker container

@someonewithpc
someonewithpc force-pushed the wrapper-command branch 2 times, most recently from 775b160 to e87c239 Compare November 19, 2024 18:06
Comment thread inf-ruby.el
WITH-BUNDLER, the command is wrapped with `bundle exec'."
(let* ((command (format (if (string-empty-p inf-ruby-wrapper-command) "%s" inf-ruby-wrapper-command)
(concat (when with-bundler "bundle exec ") "irb -v")))
(output (car (last (apply #'process-lines (split-string-and-unquote command)))))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have used split-string-shell-command, but that's only available starting Emacs 28.1, so I don't know if that's okay

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd rather use process-file-shell-command directly, similar to how process-lines is itself defined (but it uses call-process, which we'd replace). By calling shell command, we can avoid the need for splitting it.

LMK if this makes sense to you, and if it doesn't sound too hard.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understood this one, as process-file-shell-command doesn't seem to return the command output. I'm not sure how to, or if it's even a good idea to create a temporary buffer to capture the command output, as I'm not yet very well versed in elisp

Comment thread inf-ruby.el Outdated
@dgutov

dgutov commented Nov 29, 2024

Copy link
Copy Markdown
Collaborator

Hi! Thanks for the submission, see the comments.

dgutov added a commit that referenced this pull request Dec 16, 2024
@dgutov
dgutov merged commit f6f9e72 into nonsequitur:master Dec 16, 2024
dgutov added a commit that referenced this pull request Dec 16, 2024
@dgutov

dgutov commented Dec 16, 2024

Copy link
Copy Markdown
Collaborator

Thanks, merged with minor edits (e.g. using call-process-shell-command is not necessary, given that we already call split-string-and-unquote in another place anyway, but seems cleaner; the option's default value is updated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants