emacs-devel
[Top][All Lists]
Advanced

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

Re: region-active-p


From: Andreas Röhler
Subject: Re: region-active-p
Date: Sun, 21 Oct 2007 21:22:56 +0200
User-agent: KMail/1.9.5

Am Sonntag, 21. Oktober 2007 16:48 schrieb Miles Bader:
> Stefan Monnier <address@hidden> writes:
> >> The name `region-active-p'
> >> implies that it doesn't matter whether the region is empty.
> >
> > Not necessarily.  I don't consider an empty region as being really
> > "active".
>
> And in many cases an empty-but-"active" region can be pretty confusing
> if you don't realize what's going on... (e.g., undo with an
> empty-but-"active" region used to be _extremely_ confusing, though that
> seems to have been fixed).
>
> -Miles

Introducing something like 

 (not (eq (region-beginning) (region-end)))

would mean a new feature for both Emacsen

AFAIS XEmacs simple.el knows two funktions

region-active-p  and region-exists-p 

where

(defsubst region-exists-p ()
  "..."
  (not (null (mark))))

relates to the state of `mark-active' in GNU, whereas

`region-active-p' delivers something near
`transient-mark-mode'

(defun region-active-p ()
  "..."
  (and zmacs-regions zmacs-region-extent
       (eq (current-buffer) (zmacs-region-buffer))))

`region-exists-p' returns t if called at a buffer with
length 1 where the mark is set. Checked with:

(defun report-region-exists-p (&optional ispec) 
   (interactive "p")
  (if ispec (message "%s" (not (null (mark)))) 
    (not (null (mark)))))

So far 

(defsubst region-exists-p ()
  "..."
  (not (null (mark))))

could be taken as is, beneath 

(defun region-active-p ()
  "..."
  (and mark-active transient-mark-mode))

Andreas Röhler  




reply via email to

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