Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ If you cannot edit your `startup.jl`, you can configure the editor in each repl
```elisp
(add-hook 'julia-repl-hook #'julia-repl-use-emacsclient)
```
## Passing command line arguments, i.e. `push!` to `ARGS`

If you need to pass some command line arguments, you can raise the REPL with `C-u C-c C-z` and you will be promted to write you command line arguments. They will be sent to the REPL in a `push!(ARGS,[...])` call.

This is equivalent of running in the terminal

```
$ julia -i <my_scrip>.jl arg1 args2 ...
```

## More colors

Expand Down
17 changes: 14 additions & 3 deletions julia-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -642,19 +642,30 @@ Valid keys are the first items in ‘julia-repl-executable-records’."
(setq-local julia-repl--inferior-buffer-suffix suffix))
inferior-buffer)))))

(defun julia-repl--push-args (args)
(s-prepend
(s-prepend "push!(ARGS,\""
(s-join"\",\"" (s-split " " args t))) "\")" ))

(defun julia-repl--ask-for-args ()
(let ((str (read-from-minibuffer "Command line args: ")))
(if (s-present? str)
(julia-repl--send-string (julia-repl--push-args str)))))

;;;###autoload
(defun julia-repl ()
(defun julia-repl (args)
"Raise the Julia REPL inferior buffer, creating one if it does not exist.

This is the standard entry point for using this package."
(interactive)
(interactive "P")
(let ((script-buffer (current-buffer))
(inferior-buffer (julia-repl-inferior-buffer)))
(with-current-buffer inferior-buffer
(setq julia-repl--script-buffer script-buffer))
(if julia-repl-pop-to-buffer
(pop-to-buffer inferior-buffer)
(switch-to-buffer inferior-buffer))))
(switch-to-buffer inferior-buffer)))
(if args (julia-repl--ask-for-args)))

(defun julia-repl--switch-back ()
"Switch to the buffer that was active before last call to `julia-repl'."
Expand Down