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

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