diff --git a/esv.el b/esv.el index ebd157f..efbc2c7 100644 --- a/esv.el +++ b/esv.el @@ -39,6 +39,10 @@ :prefix "esv-" :group 'applications) +(defcustom esv-close-existing-buffers nil + "Whether to close an existing `esv' buffer if one already exists." + :type 'boolean + :group 'esv) (defcustom esv-columns 72 "Length of each line output by `esv'." :type 'natnum @@ -78,8 +82,10 @@ esv can be acquired at ." (list (format "-l%d" esv-columns))))) (catch 'buffer-exists (when (get-buffer buffer) - (message "Buffer `%s' already exists" buffer) - (throw 'buffer-exists nil)) + (unless esv-close-existing-buffers + (message "Buffer `%s' already exists" buffer) + (throw 'buffer-exists nil)) + (kill-buffer buffer)) (apply #'call-process esv-program nil buffer t (append arg-list (list book) (list verses))) (display-buffer buffer)