On Fri, Mar 17, 2017 at 4:16 AM, Andreas Röhler <andreas.roehler@online.de> wrote:--8<---------------cut here---------------start------------->8--- (defun my-command (beg end) (interactive "r") (if (use-region-p) (my-command-region beg end) (my-command-non-region))) --8<---------------cut here---------------end--------------->8---AFAIK, you cannot use the (interactive "r") form for this "dwim-ish" kind of behavior.Why that? If a region is set, why should (use-region-p) fail?(use-region-p) doesn't fail, the "r" in interactive fails, when there is no mark (i.e., when a region is not and has never been set). It's basically equivalent to this: (defun my-command (beg end) (interactive (sort (list (point) (mark)) #'<)) (if (use-region-p) (my-command-region beg end) (my-command-non-region)))