unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: Why act from point forward by default, instead of whole buffer?
Date: Mon, 24 Sep 2007 10:27:49 -0700	[thread overview]
Message-ID: <DHEEKFAFJEFOJHLCFPFDCEEJCBAA.drew.adams@oracle.com> (raw)

General question that occurred to me while reading thread "keep|flush-lines,
how-many to be used backward": What is the advantage of having such commands
(`keep-lines' and many others) act, by default, from point forward instead
of (by default) on the entire buffer?

They do act on the region, if it is active, so that's good. But why not have
the entire buffer be the default if the region is not active? I use that
behavior for many commands I define.

(defun region-or-buffer-limits ()
    "Return the start and end of the region as a list, smallest first.
If the region is not active or is empty, then use bob and eob."
  (if (or (not mark-active) (null (mark)) (= (point) (mark)))
      (list (point-min) (point-max))
    (if (< (point) (mark))
        (list (point) (mark))
      (list (mark) (point)))))

I also have keys that select the region before and after point, in case I do
want to act on that text.

             reply	other threads:[~2007-09-24 17:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 17:27 Drew Adams [this message]
2007-09-24 17:42 ` Why act from point forward by default, instead of whole buffer? Davis Herring
2007-09-24 18:55   ` Drew Adams
2007-09-24 19:14     ` Davis Herring
2007-09-24 21:05       ` Drew Adams
2007-09-25 10:44 ` Richard Stallman

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=DHEEKFAFJEFOJHLCFPFDCEEJCBAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@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.
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).