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: Tue, 11 Dec 2007 12:52:25 +0100
User-agent: KMail/1.9.5

Am Dienstag, 11. Dezember 2007 10:57 schrieb Juri Linkov:
> >> I came up with a better solution to the question of what region-active-p
> >> should do when the region is empty: make it a user option.
> >> I think that will make people happy, because I expect most users will
> >> have the same preference for all the commands.
> >>
> >> I will install it when I have a good connection.
> >
> > That certainly wouldn't be wrong on the logical level,
> > however can't help in original case, reduces
> > compatibilty rather than enhances them.
> >
> > My idea was to make the writing of compatible code a
> > little bit easier, to get rid of one of these (featurep
> > 'xemacs) forms occasionally.
> >
> > If you could ask Juri to install his answer we will all
> > live in a better world. :)
>
> I proposed:
>
> (defun region-active-p ()
>     (and transient-mark-mode mark-active
>        (not (eq (region-beginning) (region-end)))))
>
> And as I understand, Richard wants:
>
> (defun region-active-p ()
>     (and transient-mark-mode mark-active
>        (if some-new-user-option
>              (not (eq (region-beginning) (region-end))))))
>
> This seems like a good solution.


That new design of `region-active-p' would permit
behaving as `region-exists-p',

the result therefor will not be comparable with XEmacs,
even if it will differ only on a mince level. GNU user
then is able to allow something, which in not allowed
in XE, where to be `active' region _must_ have an
extend.

But why introduce new diffs? If there is a need I will
change my mind.

Until then I see two practical cases: 

- a region with an extend is needed
- if mark is set it's sufficient

Both questions are served already. For case two
`mark-active' or `region-exists-p' are enough, case one
is perfect answered with `region-active-p' in it's
comparable variant.

BTW if something deserves a `new-user-option' here, IMO
it's `transient-mark-mode', because to permit highlighting or not
has not really a meaning about the existence of the
region.

Then I come to this

(defun region-active-p ()
  (if user-requires-transient-mark-mode
      (and transient-mark-mode mark-active
           (not (eq (region-beginning) (region-end))))
    (not (eq (region-beginning) (region-end)))))


Andreas Röhler






reply via email to

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