help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: [External] : interactive to do `use-region-p'


From: Emanuel Berg
Subject: Re: [External] : interactive to do `use-region-p'
Date: Mon, 07 Nov 2022 18:25:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Drew Adams wrote:

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

Well, because it requires Lisp code and manual work to do
routine stuff (use the region if set, assign default values to
optional arguments), all that can be automated several steps
further pretty easily I dare say ...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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