Skip to content

Commit

Permalink
Add option to save buffer on send (#70)
Browse files Browse the repository at this point in the history
Add option to save buffer on send, both with `include` and `includet`.
  • Loading branch information
antoine-levitt authored and tpapp committed Sep 8, 2019
1 parent 1ed9d0d commit d120e1d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions julia-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ Note that this affects all buffers using the ‘ansi-term’ map."
:type 'boolean
:group 'julia-repl)

(defcustom julia-repl-save-buffer-on-send nil
"When non-nil, save buffer without prompting on send."
:type 'boolean
:group 'julia-repl)

;;
;; global variables
;;
Expand Down Expand Up @@ -512,7 +517,7 @@ this with a prefix argument ARG."
(interactive "P")
(let* ((file (and (not arg) buffer-file-name)))
(when (and file (buffer-modified-p))
(if (y-or-n-p "Buffer modified, save? ")
(if (or julia-repl-save-buffer-on-send (y-or-n-p "Buffer modified, save? "))
(save-buffer)
(setq file nil)))
(julia-repl--send-string
Expand All @@ -532,7 +537,7 @@ If a buffer corresponds to a file and is not saved, the function prompts the use
(if file
(progn
(when (buffer-modified-p)
(if (y-or-n-p "Buffer modified, save? ")
(if (or julia-repl-save-buffer-on-send (y-or-n-p "Buffer modified, save? "))
(save-buffer)
(unless (file-exists-p file)
(message "need to save the file first"))))
Expand Down

0 comments on commit d120e1d

Please sign in to comment.