Skip to content

Commit 83bb815

Browse files
committed
Remove unrelated prompt in interactive spec
This is a confusing way to use the interactive spec, as it doesn't return any arguments.
1 parent cafea90 commit 83bb815

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

ledger-check.el

+10-7
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,22 @@
109109
(set-window-configuration ledger-check--original-window-configuration)
110110
(kill-buffer (get-buffer ledger-check-buffer-name)))
111111

112-
(defun ledger-check-buffer ()
112+
(defun ledger-check-buffer (&optional interactive)
113113
"Check the current buffer for errors.
114114
115115
Runs ledger with --explicit and --strict report errors and assist
116116
with fixing them.
117117
118118
The output buffer will be in `ledger-check-mode', which defines
119-
commands for navigating the buffer to the errors found, etc."
120-
(interactive
121-
(progn
122-
(when (and (buffer-modified-p)
123-
(y-or-n-p "Buffer modified, save it? "))
124-
(save-buffer))))
119+
commands for navigating the buffer to the errors found, etc.
120+
121+
When INTERACTIVE is non-nil (i.e., when called interactively),
122+
prompt to save if the current buffer is modified."
123+
(interactive "p")
124+
(when (and interactive
125+
(buffer-modified-p)
126+
(y-or-n-p "Buffer modified, save it? "))
127+
(save-buffer))
125128
(let ((_buf (find-file-noselect (ledger-master-file)))
126129
(cbuf (get-buffer ledger-check-buffer-name))
127130
(wcfg (current-window-configuration)))

0 commit comments

Comments
 (0)