unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: [External] : interactive to do `use-region-p'
Date: Mon, 07 Nov 2022 18:25:56 +0100	[thread overview]
Message-ID: <87iljqoevv.fsf@dataswamp.org> (raw)
In-Reply-To: SJ0PR10MB54889DCAB88C4024E079CAE8F33C9@SJ0PR10MB5488.namprd10.prod.outlook.com

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	other threads:[~2022-11-07 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06 13:45 interactive to do `use-region-p' Emanuel Berg
2022-11-06 15:41 ` [External] : " Drew Adams
2022-11-06 18:53   ` Emanuel Berg
2022-11-07  1:41   ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-11-07  2:29     ` Drew Adams
2022-11-07 12:28       ` Emanuel Berg
2022-11-07 15:51         ` Drew Adams
2022-11-07 17:25           ` Emanuel Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iljqoevv.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).