emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (interactive "r") and (use-region-p)


From: Stefan Monnier
Subject: Re: (interactive "r") and (use-region-p)
Date: Thu, 16 Mar 2017 15:07:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> --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)))

I think this should be

    (defun my-command (beg end)
      (interactive
       (if (use-region-p) (list (region-beginning) (region-end))
         (lit something else)))
      ...)

IOW the command should depend on (use-region-p) but not the
function.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]