@@ -143,7 +143,7 @@ WORKING-DIRECTORY see the documentation of the `reformatter-define' macro."
143
143
(delete-file stdout-file))))
144
144
145
145
;;;### autoload
146
- (cl-defmacro reformatter-define (name &key program args (mode t ) (stdin t ) (stdout t ) input-file lighter keymap group (exit-code-success-p 'zerop ) working-directory )
146
+ (cl-defmacro reformatter-define (name &key program args (mode t ) (stdin t ) (stdout t ) input-file lighter keymap group (exit-code-success-p 'zerop ) working-directory interactive-modes )
147
147
" Define a reformatter command with NAME.
148
148
149
149
When called, the reformatter will use PROGRAM and any ARGS to
@@ -241,7 +241,16 @@ WORKING-DIRECTORY
241
241
242
242
Directory where your reformatter program is started. If provided, this
243
243
should be a form that evaluates to a string at runtime. Default is the
244
- value of `default-directory' in the buffer."
244
+ value of `default-directory' in the buffer.
245
+
246
+ INTERACTIVE-MODES
247
+
248
+ If provided, this is a list of mode names (as unquoted
249
+ symbols). The created commands for formatting regions and
250
+ buffers are then tagged for interactive use in these modes,
251
+ making them compatible with some built-in predicate functions
252
+ for `read-extended-command-predicate' , like
253
+ `command-completion-default-include-p' ."
245
254
(declare (indent defun ))
246
255
(cl-assert (symbolp name))
247
256
(cl-assert (functionp exit-code-success-p))
@@ -282,7 +291,7 @@ might use:
282
291
" Reformats the region from BEG to END.
283
292
When called interactively, or with prefix argument
284
293
DISPLAY-ERRORS, shows a buffer if the formatting fails."
285
- (interactive " rp" )
294
+ (interactive " rp" ,@interactive-modes )
286
295
(let ((input-file ,(if input-file
287
296
input-file
288
297
`(reformatter--make-temp-file ', name ))))
@@ -300,7 +309,7 @@ DISPLAY-ERRORS, shows a buffer if the formatting fails."
300
309
" Reformats the current buffer.
301
310
When called interactively, or with prefix argument
302
311
DISPLAY-ERRORS, shows a buffer if the formatting fails."
303
- (interactive " p" )
312
+ (interactive " p" ,@interactive-modes )
304
313
(message " Formatting buffer " )
305
314
(, region-fn-name (point-min ) (point-max ) display-errors))
306
315
0 commit comments