GNU bug report logs - #58608
29.0.50; Nasty bug with pasting primary selection in term buffers

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Tue, 18 Oct 2022 10:11:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 58608 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: 58608 <at> debbugs.gnu.org
Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in
 term buffers
Date: Wed, 19 Oct 2022 16:22:32 +1300
> In line mode middle click calls `mouse-⁠yank-⁠primary'

I realised I should look at this as well, and sure enough it has
some handling for `select-active-regions':

(defun mouse-yank-primary (click)
  "Insert the primary selection at the position clicked on.
Move point to the end of the inserted text, and set mark at
beginning.  If `mouse-yank-at-point' is non-nil, insert at point
regardless of where you click."
  (interactive "e")
  ;; Give temporary modes such as isearch a chance to turn off.
  (run-hooks 'mouse-leave-buffer-hook)
  ;; Without this, confusing things happen upon e.g. inserting into
  ;; the middle of an active region.
  (when select-active-regions
    (let (select-active-regions)
      (deactivate-mark)))
  (or mouse-yank-at-point (mouse-set-point click))
  (let ((primary (gui-get-primary-selection)))
    (push-mark)
    (insert-for-yank primary)))


The call to (mouse-set-point click) is also conditional here:

(or mouse-yank-at-point (mouse-set-point click))

As opposed to:

(defun term-mouse-paste (click)
  "Insert the primary selection at the position clicked on."
  (interactive "e")
  ;; Give temporary modes such as isearch a chance to turn off.
  (run-hooks 'mouse-leave-buffer-hook)
  (setq this-command 'yank)
  (mouse-set-point click)
  (term-send-raw-string (gui-get-primary-selection)))


I don't know if `mouse-yank-at-point' needs consideration here too?

I wondered whether both of these could be rewritten to use a common
subroutine, but it might be a bit awkward.  Failing that, I would
cross-reference them in code comments (are there any other similar
functions besides?).






This bug report was last modified 1 year and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.