bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#27530: patch to cut and copy secondary


From: Eli Zaretskii
Subject: bug#27530: patch to cut and copy secondary
Date: Fri, 08 Sep 2017 11:27:21 +0300

> Date: Fri, 08 Sep 2017 08:02:08 +0900 (JST)
> Cc: address@hidden, address@hidden
> From: Tak Kunihiro <address@hidden>
> 
> How about having those in lisp/subr.el?  An user can still manipulate the
> secondary selection.  Sorry for shortage for words.
> 
>  -- Function: overlay-exchange-region overlay
>      This function exchanges the region and OVERLAY.
>      When the region is active, this sets OVERLAY from the region.
>      When the region is not active but OVERLAY exists, this sets the
>      region from OVERLAY.

Does this do anything but call overlay-to-region and
overlay-from-region? 

> -- Function: overlay-exists-p overlay
>     This function returns if OVERLAY exists in current buffer.
>     When OVERLAY exists, this returns list of start and end of
>     OVERLAY.

This is just

  (memq OVERLAY (overlays-in (point-min) (point-max)))

Right?

> -- Function: overlay-to-region overlay
>     This function sets the region to text in OVERLAY.
>     This works when OVERLAY exists and the region does not exist in
>     current buffer.  The OVERLAY will be deleted.

I don't understand this one.  I guess "text in OVERLAY" is confusing;
did you mean OVERLAY's beginning and end?

> -- Function: overlay-from-region overlay
>     This function sets OVERLAY to text in the region.
>     When the region does not exists, set OVERLAY to point.  When
>     point is within OVERLAY, do nothing.

In sum, I think these are too general: they talk about OVERLAY in
general, whereas what you really mean is the special overlay used for
secondary selection.  So how about these instead:

  secondary-selection-exist-p
  secondary-selection-from-region
  secondary-selection-to-region

?  The advantage is that the caller will not have to pass OVERLAY,
which IMO is an unnecessary burden.

Thanks.





reply via email to

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