unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why act from point forward by default, instead of whole buffer?
@ 2007-09-24 17:27 Drew Adams
  2007-09-24 17:42 ` Davis Herring
  2007-09-25 10:44 ` Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Drew Adams @ 2007-09-24 17:27 UTC (permalink / raw)
  To: Emacs-Devel

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why act from point forward by default, instead of whole buffer?
  2007-09-24 17:27 Why act from point forward by default, instead of whole buffer? Drew Adams
@ 2007-09-24 17:42 ` Davis Herring
  2007-09-24 18:55   ` Drew Adams
  2007-09-25 10:44 ` Richard Stallman
  1 sibling, 1 reply; 6+ messages in thread
From: Davis Herring @ 2007-09-24 17:42 UTC (permalink / raw)
  To: Drew Adams; +Cc: Emacs-Devel

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

Not everyone uses Transient Mark mode.  If they acted on the whole buffer,
you would have to use narrowing to restrain them in any way.  By acting
forward, one common case can be handled with no prefix, and the whole
buffer with just M-<, and narrowing (again) otherwise.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why act from point forward by default, instead of whole buffer?
  2007-09-24 17:42 ` Davis Herring
@ 2007-09-24 18:55   ` Drew Adams
  2007-09-24 19:14     ` Davis Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2007-09-24 18:55 UTC (permalink / raw)
  To: herring; +Cc: Emacs-Devel

> > 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.
>
> Not everyone uses Transient Mark mode.  If they acted on the whole buffer,
> you would have to use narrowing to restrain them in any way.  By acting
> forward, one common case can be handled with no prefix, and the whole
> buffer with just M-<, and narrowing (again) otherwise.

Good point. So the current behavior is there to fit the default behavior of
not having transient-mark mode on.

We should change the default anyway, so transient-mark mode is on. We've
discussed that before, but the battle has not yet been won. After it is,
perhaps we can revisit this question, since the only reason given (so far)
for this behavior is to fit non-transient-mark mode.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why act from point forward by default, instead of whole buffer?
  2007-09-24 18:55   ` Drew Adams
@ 2007-09-24 19:14     ` Davis Herring
  2007-09-24 21:05       ` Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Davis Herring @ 2007-09-24 19:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: Emacs-Devel

> We should change the default anyway, so transient-mark mode is on. We've
> discussed that before, but the battle has not yet been won. After it is,
> perhaps we can revisit this question, since the only reason given (so far)
> for this behavior is to fit non-transient-mark mode.

Even if transient-mark-mode becomes the default, the reason remains valid,
because there will still be people who do not use it.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why act from point forward by default, instead of whole buffer?
  2007-09-24 19:14     ` Davis Herring
@ 2007-09-24 21:05       ` Drew Adams
  0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2007-09-24 21:05 UTC (permalink / raw)
  To: herring; +Cc: Emacs-Devel

> > We should change the default anyway, so transient-mark mode is on. We've
> > discussed that before, but the battle has not yet been won. After it is,
> > perhaps we can revisit this question, since the only reason
> > given (so far) for this behavior is to fit non-transient-mark mode.
>
> Even if transient-mark-mode becomes the default, the reason remains valid,
> because there will still be people who do not use it.

Not if the reason is that this is so _because it is the default_.

Depending on which is the default behavior, and whether you use that
behavior or override it, one or the other behavior here (current or what I
proposed) will appear beneficial.

At least that's my argument. You are saying that the current behavior is
fitting for use with non-transient-mark mode. And I am saying (and I think
you agreed, but I'm not sure) that the behavior I proposed is fitting for
transient-mark mode.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why act from point forward by default, instead of whole buffer?
  2007-09-24 17:27 Why act from point forward by default, instead of whole buffer? Drew Adams
  2007-09-24 17:42 ` Davis Herring
@ 2007-09-25 10:44 ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2007-09-25 10:44 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    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.

It is historical tradition and I would rather not change it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-09-25 10:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-24 17:27 Why act from point forward by default, instead of whole buffer? Drew Adams
2007-09-24 17:42 ` 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

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