emacs-devel
[Top][All Lists]
Advanced

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

Why act from point forward by default, instead of whole buffer?


From: Drew Adams
Subject: Why act from point forward by default, instead of whole buffer?
Date: Mon, 24 Sep 2007 10:27:49 -0700

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 via email to

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