hmm, I can't reproduce here, but is it possible you have bound C-M-\
to some other command which calls indent-region non-interactively?
Thanks for verifying. Of course it was my config..
This deviates from this bug report.. but I am open to suggestions on how I could retain the * property of the interactive form while setting the region boundaries as I do in the below advice.
I confirm that your suggestion also works fine if I remove the below advice from my config.
=====
(defvar modi/region-or-whole-fns '(indent-region
eval-region)
"List of functions to act on the whole buffer if no region is selected.")
(defun modi/advice-region-or-whole (orig-fun &rest args)
"Advice function that applies ORIG-FUN to the whole buffer if no region is
selected.
;; Required to override the "r" argument of `interactive' in functions like
;; `indent-region' so that they can be called without an active region.
(interactive (if (use-region-p)
(list (region-beginning) (region-end))
(list (point-min) (point-max))))
;; (message "Args: %S R: %S I: %S"
;; args (use-region-p) (called-interactively-p 'interactive))
(prog1 ; Return value of the advising fn needs to be the same as ORIG-FUN
(apply orig-fun args)
(when (and (called-interactively-p 'interactive)
(not (use-region-p)))
(message "Executed %s on the whole buffer."
(propertize (symbol-name this-command)
'face 'font-lock-function-name-face)))))
(dolist (fn modi/region-or-whole-fns)
(advice-add fn :around #'modi/advice-region-or-whole)
;; (advice-remove fn #'modi/advice-region-or-whole)
)
=====