From d120e1d10c3bc16fdd343c5e0b024dc68461b3c0 Mon Sep 17 00:00:00 2001 From: Antoine Levitt Date: Sun, 8 Sep 2019 19:17:54 +0200 Subject: [PATCH] Add option to save buffer on send (#70) Add option to save buffer on send, both with `include` and `includet`. --- julia-repl.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/julia-repl.el b/julia-repl.el index b857a97..46e7c7d 100644 --- a/julia-repl.el +++ b/julia-repl.el @@ -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 ;; @@ -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 @@ -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"))))