[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : interactive to do `use-region-p'
From: |
Drew Adams |
Subject: |
RE: [External] : interactive to do `use-region-p' |
Date: |
Mon, 7 Nov 2022 15:51:52 +0000 |
> > case of region/buffer-limit args, plus additional args.
> > (defun foo (beg end other)
> > (interactive `(,@(dtrt) ,(+ 2 7)))
> > ...)
>
> You mean like this?
...
> (defun enum (&optional beg end suf)
> "Enumerate each line from BEG to END, counting from one.
> Use SUF as a suffix to the digits inserted.
> BEG defaults to the beginning of the buffer,
> END defaults to the end of the buffer, and
> SUF defaults to \". \""
> (interactive
> `(,@(if (use-region-p)
> (list (region-beginning) (region-end))
> (list nil nil) )
> ,(when current-prefix-arg
> (read-string "suffix: ") )))
> (or beg (setq beg (point-min)))
> (or end (setq end (point-max)))
...
Sure, why not?
Or define that (if...) as a function and use that.
Re: [External] : interactive to do `use-region-p', Emanuel Berg, 2022/11/07