[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: |
Wed, 20 Sep 2017 10:55:33 +0300 |
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Mon, 11 Sep 2017 11:03:58 +0900
> Cc: Kunihiro Tak <tkk@misasa.okayama-u.ac.jp>,
> 27530@debbugs.gnu.org
>
> I am sending a patch relative to lisp/mouse.el to let user to
> set beginning and end of the region from those of the secondary
> selection. I hope this meets your comments and please revise
> when it’s not good!
Thanks. A few minor comments below.
> +(defun secondary-selection-exist-p ()
> + "Return if there is the secondary selection in current buffer."
> + (memq mouse-secondary-overlay (overlays-in (point-min) (point-max))))
> +
> +(defun secondary-selection-to-region ()
> + "Set beginning and end of the region to those of the secondary selection.
> +This works when the secondary selection exists and the region
> +does not exist in current buffer. The secondary selection will
> +be deleted afterward."
The doc string should describe where we put point and mark as result
of this.
> + (when (and (not (region-active-p))
> + (secondary-selection-exist-p))
> + (let* ((beg (overlay-start mouse-secondary-overlay))
> + (end (overlay-end mouse-secondary-overlay))
> + ;; Restore point to whichever closer.
> + (is-point-front (< (point) (/ (+ beg end) 2))))
> + (push-mark (if is-point-front end beg) t t)
> + (goto-char (if is-point-front beg end)))
Is it perhaps better to always put point at the end and mark at the
beginning of the overlay? The heuristic seems to be complicating
matters for applications, which will have to perform the same
calculations to know in advance where point will be.
> +(defun secondary-selection-from-region ()
> + "Set beginning and end of the secondary selection to those of the region."
This doc string should tell what happens if there's no active region.
Please also add a NEWS entry.
- bug#27530: patch to cut and copy secondary, (continued)
- bug#27530: patch to cut and copy secondary, Tak Kunihiro, 2017/09/05
- bug#27530: patch to cut and copy secondary, Eli Zaretskii, 2017/09/05
- bug#27530: patch to cut and copy secondary, Tak Kunihiro, 2017/09/05
- bug#27530: patch to cut and copy secondary, Eli Zaretskii, 2017/09/06
- bug#27530: patch to cut and copy secondary, Tak Kunihiro, 2017/09/07
- bug#27530: patch to cut and copy secondary, Eli Zaretskii, 2017/09/07
- bug#27530: patch to cut and copy secondary, Tak Kunihiro, 2017/09/07
- bug#27530: patch to cut and copy secondary, Eli Zaretskii, 2017/09/08
- bug#27530: patch to cut and copy secondary, Tak Kunihiro, 2017/09/09
- bug#27530: patch to cut and copy secondary, Tak Kunihiro, 2017/09/10
- bug#27530: patch to cut and copy secondary,
Eli Zaretskii <=
- bug#27530: patch to cut and copy secondary, Tak Kunihiro, 2017/09/20
- bug#27530: patch to cut and copy secondary, Eli Zaretskii, 2017/09/21