unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kelly Dean <kelly@prtime.org>
Cc: emacs-devel@gnu.org
Subject: Re: kill-region in 24.4 shouldn't require BEG and END
Date: Sat, 15 Nov 2014 10:22:24 -0500	[thread overview]
Message-ID: <jwvfvdkzeca.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <emacs-mail-is-unusable-1> (Kelly Dean's message of "Sat, 15 Nov 2014 06:55:38 +0000")

> If the REGION argument is non-nil, then BEG and END shouldn't be
> required, since they're unused (except in one place where they aren't
> needed).  So the test
>    ⌜unless (and beg end)⌝
> in kill-region should be
>    ⌜unless (or region (and beg end))⌝
> and the docstring should point out that if REGION is non-nil, then BEG
> and END are unused and might as well be nil.

I think a simpler change would be to add, right after the `interactive'
line, a simple:

   (if region (setq beg (mark) end (point)))

Which would make it obvious that the beg/end arguments are not used when
region is non-nil, without having to scan the rest of the code.  And it
would keep the rest of the code simpler (less sprinkling of tests of
`region').

And we could even use another API where we only have BEG and END and say
that if BEG is the symbol `region', then use *the* region.


        Stefan



       reply	other threads:[~2014-11-15 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <emacs-mail-is-unusable-1>
2014-11-15 15:22 ` Stefan Monnier [this message]
     [not found] <emacs-mail-is-unusable-1@[87.69.4.28]>
2014-11-15  8:38 ` kill-region in 24.4 shouldn't require BEG and END Eli Zaretskii
2014-11-15  6:55 Kelly Dean

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=jwvfvdkzeca.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=kelly@prtime.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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