From unknown Fri Jun 20 05:26:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#58608 <58608@debbugs.gnu.org> To: bug#58608 <58608@debbugs.gnu.org> Subject: Status: 29.0.50; Nasty bug with pasting primary selection in term buffers Reply-To: bug#58608 <58608@debbugs.gnu.org> Date: Fri, 20 Jun 2025 12:26:41 +0000 retitle 58608 29.0.50; Nasty bug with pasting primary selection in term buf= fers reassign 58608 emacs submitter 58608 Phil Sainty severity 58608 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 18 06:10:44 2022 Received: (at submit) by debbugs.gnu.org; 18 Oct 2022 10:10:44 +0000 Received: from localhost ([127.0.0.1]:51241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okjYZ-0000hb-Cx for submit@debbugs.gnu.org; Tue, 18 Oct 2022 06:10:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:45222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okjYW-0000hO-Vk for submit@debbugs.gnu.org; Tue, 18 Oct 2022 06:10:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okjYW-000619-1Q for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 06:10:40 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:39419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okjYS-0002DV-OC for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 06:10:38 -0400 Received: from [10.253.37.70] (port=56602 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1okjYJ-0006UO-Se for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 23:10:29 +1300 Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Tue, 18 Oct 2022 23:10:27 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 18 Oct 2022 23:10:27 +1300 From: Phil Sainty To: bug-gnu-emacs@gnu.org Subject: 29.0.50; Nasty bug with pasting primary selection in term buffers Message-ID: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- Received-SPF: pass client-ip=60.234.4.43; envelope-from=psainty@orcon.net.nz; helo=smtp-2.orcon.net.nz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) This one has been causing me occasional pain for years, but only rarely, and I didn't have a recipe to reproduce it until now. The following steps don't all need to be followed to the letter, but hopefully demonstrate the issue well. 0. emacs -Q 1. M-x term (and run your shell; term must be in char-mode) 2. Run "ls" # or anything else to produce a decent amount of output. 3. Run "cat >/dev/null" # for safety 4. Using the mouse, select any small piece of text several lines above the bottom of the term buffer (e.g. double- click a word). 5. Move the mouse to the shell prompt at the end of the buffer and middle click to paste that selected text as input. 6. Without moving the mouse, middle click again at the same position. 7. Be thankful for step 3. My impression is that the first middle-click unexpectedly creates a new primary selection based on the current mouse position, so the second middle-click then pastes that new selection as input. This has bitten me on many occasions when I wanted to repeat the previously-pasted command as input again, and find that I've instead asked the shell to execute a ton of unintended commands! (which, thankfully, tend to only rarely be valid). This bug exists in all the versions of Emacs I have installed at present (back to 26.3), and I think this is severe enough to fix in the emacs-28 branch as well as master. -Phil In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.10, Xaw scroll bars) of 2022-10-18 built on phil-lp Repository revision: be3d9f717dd317eafc8f511072040a5ff8c1071c Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12008000 System Description: Ubuntu 18.04.6 LTS Configured using: 'configure --prefix=/home/phil/emacs/trunk/usr/local --with-x-toolkit=lucid --without-sound '--program-transform-name=s/^ctags$/ctags_emacs/'' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LC_MONETARY: en_NZ.UTF-8 value of $LC_NUMERIC: en_NZ.UTF-8 value of $LC_TIME: en_NZ.UTF-8 value of $LANG: en_GB.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8 Major mode: Term Minor modes in effect: minibuffer-line-mode: t global-edit-server-edit-mode: t savehist-mode: t magit-wip-initial-backup-mode: t magit-wip-before-change-mode: t magit-wip-after-apply-mode: t magit-wip-after-save-mode: t magit-wip-mode: t global-git-commit-mode: t magit-auto-revert-mode: t shell-dirtrack-mode: t my-contextual-help-mode: t global-so-long-mode: t display-battery-mode: t my-visible-bell-mode: t global-display-fill-column-indicator-mode: t display-fill-column-indicator-mode: t minibuffer-depth-indicate-mode: t which-key-mode: t windmove-mode: t winner-mode: t global-subword-mode: t display-time-mode: t keep-buffers-mode: t my-keys-local-minor-mode: t auto-compile-on-load-mode: t auto-compile-on-save-mode: t url-handler-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: /home/phil/.emacs.d.sandboxes/trunk/HOME/.emacs.d/el-get/scratch/el-get hides /home/phil/.emacs.d.sandboxes/trunk/HOME/.emacs.d/el-get/el-get/el-get /home/phil/.emacs.d.sandboxes/trunk/HOME/.emacs.d/el-get/delight/delight hides /home/phil/.emacs.d.sandboxes/trunk/HOME/.emacs.d/elpa/delight-1.7/delight /home/phil/.emacs.d.sandboxes/trunk/HOME/.emacs.d/el-get/transient/lisp/transient hides /home/phil/emacs/trunk/usr/local/share/emacs/29.0.50/lisp/transient /home/phil/.emacs.d.sandboxes/trunk/HOME/.emacs.d/lisp/python hides /home/phil/emacs/trunk/usr/local/share/emacs/29.0.50/lisp/progmodes/python Features: (shadow sort project-local-variables ecomplete mail-extr emacsbug term disp-table ehelp dired-aux elisp-slime-nav etags fileloop generator xref project hl-sexp lexbind-mode idle-highlight-mode tramp-sh warnings docker-tramp tramp-cache time-stamp tramp tramp-loaddefs trampver tramp-integration cus-start files-x tramp-compat parse-time iso8601 ls-lisp tabify minibuffer-line edit-server my-org my-projects my-session savehist desktop frameset my-theme zenburn-theme my-mail autoloads my-libraries sudo my-version-control magit-wip magit-log which-func imenu edebug debug backtrace find-func magit-diff smerge-mode diff git-commit rx log-edit message sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert autorevert filenotify magit-margin magit-transient magit-process with-editor shell pcomplete comint ansi-osc server ansi-color magit-mode transient pcase edmacro kmacro compat compat-macs format-spec magit-git magit-section magit-utils crm dash my-text my-programming my-python so-long my-whitespace ws-trim my-rectangles my-utilities browse-kill-ring my-configuration cus-edit pp cus-load wid-edit dired-details dired-x highlight-parentheses battery delight delsel cua-base ffap display-fill-column-indicator mb-depth which-key framemove windmove winner ring cap-words superword subword hl-line time my-externals .loaddefs windcycle transpose-frame simple-wiki derived sdcv-mode noutline outline icons sauron rainbow-mode notify dbus xml multiple-cursors mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more thingatpt mc-cycle-cursors mc-edit-lines multiple-cursors-core rect mo-git-blame keep-buffers iedit fic-mode dtrt-indent browse-at-remote vc-git diff-mode easy-mmode vc-dispatcher s el-get cl-extra help-mode autoload loaddefs-gen radix-tree lisp-mnt cl dired dired-loaddefs jka-compr my-local my-keybindings auto-compile packed compat-autoloads etags-select-autoloads info project-local-variables-autoloads advice wtf-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile cconv url-vars cl-loaddefs cl-lib rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 257815 38654) (symbols 48 24320 0) (strings 32 74590 14132) (string-bytes 1 2492927) (vectors 16 39953) (vector-slots 8 456801 46856) (floats 8 202 110) (intervals 56 886 0) (buffers 1000 14)) From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 18 19:10:22 2022 Received: (at 58608) by debbugs.gnu.org; 18 Oct 2022 23:10:22 +0000 Received: from localhost ([127.0.0.1]:55025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okvj0-0000P8-Ou for submit@debbugs.gnu.org; Tue, 18 Oct 2022 19:10:22 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:35127) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okviu-0000Oo-SN for 58608@debbugs.gnu.org; Tue, 18 Oct 2022 19:10:17 -0400 Received: from [10.253.37.70] (port=46490 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1okvit-0002yz-47 for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 12:10:11 +1300 Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 19 Oct 2022 12:10:10 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Oct 2022 12:10:10 +1300 From: Phil Sainty To: 58608@debbugs.gnu.org Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> Message-ID: X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58608 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2022-10-18 23:10, Phil Sainty wrote: > 4. Using the mouse, select any small piece of text several > lines above the bottom of the term buffer (e.g. double- > click a word). > 5. Move the mouse to the shell prompt at the end of the buffer > and middle click to paste that selected text as input. > 6. Without moving the mouse, middle click again at the same > position. In fact "Without moving the mouse" is irrelevant in step 6. All that matters is where the mouse was when you middle-clicked in step 5. All middle clicks subsequent to step 5 have the same (bad) effect regardless of the mouse position, pasting the same unintended selection each time. I presume that having an *active* selection at step 5 makes the difference. More testing confirms that the initial middle click in step 5 updates the selection with the text between the start of the active selection and the position of the middle click. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 18 20:53:15 2022 Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 00:53:15 +0000 Received: from localhost ([127.0.0.1]:55213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okxKd-0005PG-B6 for submit@debbugs.gnu.org; Tue, 18 Oct 2022 20:53:15 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:38605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okxKa-0005P5-Ol for 58608@debbugs.gnu.org; Tue, 18 Oct 2022 20:53:13 -0400 Received: from [10.253.37.70] (port=50375 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1okxKY-0003XO-0q for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 13:53:10 +1300 Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 19 Oct 2022 13:53:09 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Oct 2022 13:53:09 +1300 From: Phil Sainty To: 58608@debbugs.gnu.org Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> Message-ID: X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58608 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) The `deactivate-mark' call in `term-send-raw-string' is the direct cause of the unwanted change to the selection. In more detail... In line mode middle click calls `mouse-yank-primary', but in char mode middle click calls: (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 traced the following: (trace-function 'mouse-set-point nil (lambda () (format " [%s]" (gui-get-primary-selection)))) (trace-function 'term-mouse-paste nil (lambda () (format " [%s]" (gui-get-primary-selection)))) (trace-function 'gui-get-primary-selection) (trace-function 'term-send-raw-string) Notice that I'm triggering `gui-get-primary-selection' more often than it would otherwise be called, by also calling it for context. My terminal buffer contained the line "this is a test" and I selected "this" with the mouse, and then middle clicked after the word "test". We see `term-mouse-paste' passing `term-send-raw-string' the word "this" after obtaining it from `gui-get-primary-selection'; but then, after the return of `term-send-raw-string' but *before* the return of `term-mouse-paste', my call-for-context to `gui-get-primary-selection' fires, returning the longer string "this is a test". ====================================================================== 1 -> (term-mouse-paste (mouse-2 (# 457 (191 . 226) 421854684 nil 457 (21 . 12) nil (65 . 10) (9 . 18)))) [this] | 2 -> (gui-get-primary-selection) | 2 <- gui-get-primary-selection: #("this" 0 1 (font-lock-face term fontified t) 1 2 (font-lock-face term fontified t) 2 3 (font-lock-face term fontified t) 3 4 (font-lock-face term fontified t)) | 2 -> (mouse-set-point (mouse-2 (# 457 (191 . 226) 421854684 nil 457 (21 . 12) nil (65 . 10) (9 . 18)))) [this] | | 3 -> (gui-get-primary-selection) | | 3 <- gui-get-primary-selection: #("this" 0 1 (font-lock-face term fontified t) 1 2 (font-lock-face term fontified t) 2 3 (font-lock-face term fontified t) 3 4 (font-lock-face term fontified t)) | 2 <- mouse-set-point: 457 [this] | 2 -> (gui-get-primary-selection) | 2 <- gui-get-primary-selection: #("this" 0 1 (font-lock-face term fontified t) 1 2 (font-lock-face term fontified t) 2 3 (font-lock-face term fontified t) 3 4 (font-lock-face term fontified t)) | 2 -> (term-send-raw-string #("this" 0 1 (font-lock-face term fontified t) 1 2 (font-lock-face term fontified t) 2 3 (font-lock-face term fontified t) 3 4 (font-lock-face term fontified t))) | 2 <- term-send-raw-string: nil | 2 -> (gui-get-primary-selection) | 2 <- gui-get-primary-selection: #("this is a test" 0 1 (font-lock-face term fontified t) 1 2 (font-lock-face term fontified t) 2 3 (font-lock-face term fontified t) 3 4 (font-lock-face term fontified t) 4 5 (font-lock-face term fontified t) 5 6 (font-lock-face term fontified t) 6 7 (font-lock-face term fontified t) 7 8 (font-lock-face term fontified t) 8 9 (font-lock-face term fontified t) 9 10 (font-lock-face term fontified t) 10 11 (font-lock-face term fontified t) 11 12 (font-lock-face term fontified t) 12 13 (font-lock-face term fontified t) 13 14 (font-lock-face term fontified t)) 1 <- term-mouse-paste: nil [this is a test] ====================================================================== So immediately after (term-send-raw-string (gui-get-primary-selection)) has inserted "this" a second (gui-get-primary-selection) is returning "this is a test"; so `term-send-raw-string' itself seems like a factor. I then added some messaging like so: (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) (message "before: %s" (gui-get-primary-selection)) (term-send-raw-string (gui-get-primary-selection)) (message "after: %s" (gui-get-primary-selection))) (defun term-send-raw-string (chars) (message "0: %s" (gui-get-primary-selection)) (deactivate-mark) (message "1: %s" (gui-get-primary-selection)) ...) Which gave me these *Messages*: before: this 0: this 1: this is a test after: this is a test So the `deactivate-mark' call in `term-send-raw-string' causes the unwanted change to the selection. -Phil From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 18 21:19:23 2022 Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 01:19:24 +0000 Received: from localhost ([127.0.0.1]:55244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okxjv-00064B-OM for submit@debbugs.gnu.org; Tue, 18 Oct 2022 21:19:23 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:52447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okxjt-000643-Rn for 58608@debbugs.gnu.org; Tue, 18 Oct 2022 21:19:22 -0400 Received: from [10.253.37.70] (port=9856 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1okxjs-0005tF-9W for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 14:19:20 +1300 Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 19 Oct 2022 14:19:20 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Oct 2022 14:19:20 +1300 From: Phil Sainty To: 58608@debbugs.gnu.org Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> Message-ID: <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58608 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Looking at the docstring for `deactivate-mark' told me about `select-active-regions'. I don't know whether this is the correct solution, but I can confirm that this change to `term-mouse-paste' appears (after only cursory testing) to fix the bug: - (term-send-raw-string (gui-get-primary-selection))) + (let ((select-active-regions nil)) + (term-send-raw-string (gui-get-primary-selection)))) From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 18 22:10:04 2022 Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 02:10:04 +0000 Received: from localhost ([127.0.0.1]:55311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okyWy-0007Pb-4s for submit@debbugs.gnu.org; Tue, 18 Oct 2022 22:10:04 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:48253) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okyWu-0007P2-OA for 58608@debbugs.gnu.org; Tue, 18 Oct 2022 22:10:02 -0400 Received: from [10.253.37.70] (port=22908 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1okyWr-0001Ys-NH for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 15:09:57 +1300 Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 19 Oct 2022 15:09:57 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Oct 2022 15:09:57 +1300 From: Phil Sainty To: 58608@debbugs.gnu.org Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> Message-ID: <901d65e2e6e961136ff0053917d57a05@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58608 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Or with documentation included, in case that *is* the correct fix: - (term-send-raw-string (gui-get-primary-selection))) + ;; Prevent the `deactivate-mark' call in `term-send-raw-string' + ;; from changing this selection. + (let ((select-active-regions nil)) + (term-send-raw-string (gui-get-primary-selection)))) From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 18 23:22:37 2022 Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 03:22:37 +0000 Received: from localhost ([127.0.0.1]:55373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okzfB-0000m1-AP for submit@debbugs.gnu.org; Tue, 18 Oct 2022 23:22:37 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:36701) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okzf8-0000lq-5n for 58608@debbugs.gnu.org; Tue, 18 Oct 2022 23:22:36 -0400 Received: from [10.253.37.70] (port=27234 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1okzf6-0006vG-BD for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 16:22:32 +1300 Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 19 Oct 2022 16:22:32 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 19 Oct 2022 16:22:32 +1300 From: Phil Sainty To: 58608@debbugs.gnu.org Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <901d65e2e6e961136ff0053917d57a05@webmail.orcon.net.nz> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <901d65e2e6e961136ff0053917d57a05@webmail.orcon.net.nz> Message-ID: <28b4d56584b38019d38d6c7c9e0bb2d1@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58608 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > 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?). From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 19 01:03:30 2022 Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 05:03:30 +0000 Received: from localhost ([127.0.0.1]:55477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol1Eo-0003UN-7B for submit@debbugs.gnu.org; Wed, 19 Oct 2022 01:03:30 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:48377) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol1Ek-0003U9-Dd for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 01:03:29 -0400 Received: from [10.253.37.70] (port=41590 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1ol1Ei-0006I1-0k for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 18:03:24 +1300 Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 19 Oct 2022 18:03:23 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Oct 2022 18:03:23 +1300 From: Phil Sainty To: 58608@debbugs.gnu.org Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <28b4d56584b38019d38d6c7c9e0bb2d1@webmail.orcon.net.nz> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <901d65e2e6e961136ff0053917d57a05@webmail.orcon.net.nz> <28b4d56584b38019d38d6c7c9e0bb2d1@webmail.orcon.net.nz> Message-ID: X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58608 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2022-10-19 16:22, Phil Sainty wrote: > I don't know if `mouse-yank-at-point' needs consideration here too? No, I don't think it does. "If non-nil, mouse yank commands yank at point instead of at click." But in `term-mouse-paste' (which is only for char mode), we're neither yanking at point or click, but instead sending input to the inferior process, so I believe `mouse-yank-at-point' is irrelevant here. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 19 07:05:59 2022 Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 11:06:00 +0000 Received: from localhost ([127.0.0.1]:55962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol6tb-0007Ag-Kf for submit@debbugs.gnu.org; Wed, 19 Oct 2022 07:05:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol6tZ-0007AU-Rw for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 07:05:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol6tU-0000T8-JL; Wed, 19 Oct 2022 07:05:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cZ8EwtJ43aM224bL/7UlU5w+tytvmwfbKlR/0tmsF9c=; b=ruywPv2M51JL eO8YXgyhJAyOVBI/3ZbIvoB+RIQ99BAt8OOfcjymea6/DZeWkfLLUpl6Ln8+2/syu1nUCTXVZ3D1e Zz2+Ds69naU6MCe8pXpxqErxmOMen4bgqHulSFuJ7S2KfTHTJopM2w9WPJS1gkV+ZIeWS6dPrM4uX /qokrpmHlgGxcE+EAtllxX7vf+NEOyZIkCjuAW7V15P2OVhFC8vFATUaCmOuCunDMYYHWf01PJXpP InGsZLZccE8CaD/vxOeoWruiEhRLqUmf8P2oWhEULeF1sbDoFoJ5c82we6stn6i/ARHD1B942Iv4n 6ObWdm+bf4orxFJWU4jLBQ==; Received: from [87.69.77.57] (port=1402 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol6tN-0001z9-6M; Wed, 19 Oct 2022 07:05:50 -0400 Date: Wed, 19 Oct 2022 14:05:39 +0300 Message-Id: <83ilkgysxo.fsf@gnu.org> From: Eli Zaretskii To: Phil Sainty In-Reply-To: <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> (message from Phil Sainty on Wed, 19 Oct 2022 14:19:20 +1300) Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 19 Oct 2022 14:19:20 +1300 > From: Phil Sainty > > Looking at the docstring for `deactivate-mark' told me about > `select-active-regions'. I don't know whether this is the correct > solution, but I can confirm that this change to `term-mouse-paste' > appears (after only cursory testing) to fix the bug: > > - (term-send-raw-string (gui-get-primary-selection))) > + (let ((select-active-regions nil)) > + (term-send-raw-string (gui-get-primary-selection)))) I think it could be important to understand why select-active-regions causes this problem in your case. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 19 18:14:57 2022 Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 22:14:57 +0000 Received: from localhost ([127.0.0.1]:60373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olHKy-0006v3-QN for submit@debbugs.gnu.org; Wed, 19 Oct 2022 18:14:57 -0400 Received: from smtp-3.orcon.net.nz ([60.234.4.44]:51735) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olHKv-0006us-S4 for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 18:14:55 -0400 Received: from [10.253.37.70] (port=49104 helo=webmail.orcon.net.nz) by smtp-3.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1olHKs-00010n-Jt; Thu, 20 Oct 2022 11:14:50 +1300 Received: from ip-180-148-114-34.kinect.net.nz ([180.148.114.34]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Thu, 20 Oct 2022 11:14:50 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 20 Oct 2022 11:14:50 +1300 From: Phil Sainty To: Eli Zaretskii Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <83ilkgysxo.fsf@gnu.org> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> Message-ID: <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2022-10-20 00:05, Eli Zaretskii wrote: > From: Phil Sainty >> Looking at the docstring for `deactivate-mark' told me about >> `select-active-regions'. I don't know whether this is the correct >> solution, but I can confirm that this change to `term-mouse-paste' >> appears (after only cursory testing) to fix the bug: >> >> - (term-send-raw-string (gui-get-primary-selection))) >> + (let ((select-active-regions nil)) >> + (term-send-raw-string (gui-get-primary-selection)))) > > I think it could be important to understand why select-active-regions > causes this problem in your case. I think mechanically it's because the middle click moves point to the click position, and the call to `deactivate-mark' then causes the primary selection to be updated based on the current point and mark (unless we mess with select-active-regions). You've made me wonder, though... this command is intended only for term char mode, so should a middle click *really* be setting point? If all we're trying to do is send the selection text to the inferior process, that bit might be wrong. There's an explicit (mouse-set-point click) there, but if I comment out both that and my interim binding of `select-active-regions' then this also seems to do the right thing (once more with only very cursory testing). (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) ;; (let ((select-active-regions nil)) (term-send-raw-string (gui-get-primary-selection))) ;;) That's more of a change, but perhaps it's the correct thing to do. I'm now looking at that (setq this-command 'yank) as well, and wondering whether it's important for anything under the impression that a `yank' just happened to also see point at the location of the yank. I'm not sure whether a middle click in a terminal to send the primary selection directly to the inferior process *should* be treated as `yank' though -- maybe that code is also wrong. These changes are more nebulous to me, as they represent more of a functional change than binding `select-active-regions' does. -Phil From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 20 01:37:00 2022 Received: (at 58608) by debbugs.gnu.org; 20 Oct 2022 05:37:00 +0000 Received: from localhost ([127.0.0.1]:60928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olOEl-0001Mg-OS for submit@debbugs.gnu.org; Thu, 20 Oct 2022 01:37:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olOEi-0001MM-Q0 for 58608@debbugs.gnu.org; Thu, 20 Oct 2022 01:36:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46150) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olOEd-0004Mj-Bn; Thu, 20 Oct 2022 01:36:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SWiJteSPWKzdu2t9bTOdp+pZbYMkPs7zW4Ec+3oDX/I=; b=E3DZ7/lO/Nqx wWIs6x1Y3EnyRxJhAplVsRUEHs5ctFxjzSw/80ZjlZ7+WVMw70DBD8AsAJ85h8u4b9mo8RI8SRqBy KBKQb947b5uPiuoFDfqIaxkzv2Wf3h+bbbdHfUqcAFgiOXKq6r29fTXskvQwUb7kio1jeGdsSJ6qn NwN+apE1OqSWLulzuJmtQECoaAxWq4j9+oMjSOxYcZbHk8z5Qt48QjoWgDO4OPGZjHnJaHQRt4OpW 2TMnzveOlAfvjUXvFZjYoRnWDN/E9KOKcuPCQIHPeQNQ9hpBVazmyFA38YlHzF6LiKT4/E0gc14G9 wXzFgEs+1soqirLTpmeMag==; Received: from [87.69.77.57] (port=2349 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olOEa-0007oc-Lj; Thu, 20 Oct 2022 01:36:48 -0400 Date: Thu, 20 Oct 2022 08:36:35 +0300 Message-Id: <835ygfys2k.fsf@gnu.org> From: Eli Zaretskii To: Phil Sainty In-Reply-To: <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> (message from Phil Sainty on Thu, 20 Oct 2022 11:14:50 +1300) Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 20 Oct 2022 11:14:50 +1300 > From: Phil Sainty > Cc: 58608@debbugs.gnu.org > > > I think it could be important to understand why select-active-regions > > causes this problem in your case. > > I think mechanically it's because the middle click moves point to the > click position, and the call to `deactivate-mark' then causes the > primary selection to be updated based on the current point and mark > (unless we mess with select-active-regions). > > You've made me wonder, though... this command is intended only for > term char mode, so should a middle click *really* be setting point? > If all we're trying to do is send the selection text to the inferior > process, that bit might be wrong. It could be, but maybe looking at the Git history of that code will tell you why we have that part there? I mean, maybe there are use cases where that is important? If nothing comes up, I think you are right, and that move should be removed. On a GUI frame, a middle click leaves point _at_the_end_ of the inserted text, not where I click. But if we aren't sure, it's okay to momentarily disable select-active-regions here, we just need a comment with the explanation you wrote above. > I'm now looking at that (setq this-command 'yank) as well, and > wondering whether it's important for anything under the impression > that a `yank' just happened to also see point at the location of > the yank. I'm not sure whether a middle click in a terminal to > send the primary selection directly to the inferior process *should* > be treated as `yank' though -- maybe that code is also wrong. Indeed, we don't by default treat middle click as yank on GUI frames. So maybe you are right -- but please note that there are some user options which perhaps do cause the middle click to be treated as yank as optional behavior, in which case they should do the same in the term case. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 14 08:46:34 2023 Received: (at 58608) by debbugs.gnu.org; 14 Mar 2023 12:46:34 +0000 Received: from localhost ([127.0.0.1]:36641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pc42z-00033u-OU for submit@debbugs.gnu.org; Tue, 14 Mar 2023 08:46:34 -0400 Received: from smtp-1.orcon.net.nz ([60.234.4.34]:32809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pc42y-00033m-2x for 58608@debbugs.gnu.org; Tue, 14 Mar 2023 08:46:33 -0400 Received: from [10.253.37.70] (port=52492 helo=webmail.orcon.net.nz) by smtp-1.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1pc42v-0001JJ-AR; Wed, 15 Mar 2023 01:46:30 +1300 Received: from ip-180-148-124-51.kinect.net.nz ([180.148.124.51]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 15 Mar 2023 01:46:28 +1300 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_80e76aeb33181c113278f0cfb92f5719" Date: Wed, 15 Mar 2023 01:46:28 +1300 From: Phil Sainty To: Eli Zaretskii Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <835ygfys2k.fsf@gnu.org> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> <835ygfys2k.fsf@gnu.org> Message-ID: <628154950d12e3e6c6989ae14f843bbb@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org, "Richard M. Stallman" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=_80e76aeb33181c113278f0cfb92f5719 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 2022-10-20 18:36, Eli Zaretskii wrote: >> Date: Thu, 20 Oct 2022 11:14:50 +1300 >> From: Phil Sainty >> You've made me wonder, though... this command is intended only for >> term char mode, so should a middle click *really* be setting point? >> If all we're trying to do is send the selection text to the inferior >> process, that bit might be wrong. > > It could be, but maybe looking at the Git history of that code will > tell you why we have that part there? I mean, maybe there are use > cases where that is important? > > If nothing comes up, I think you are right, and that move should be > removed. On a GUI frame, a middle click leaves point _at_the_end_ of > the inserted text, not where I click. I don't have my head around all of this, but I've done some digging... The call to `mouse-set-point' in `term-mouse-paste' dates back to its origins in commit 4060e6ee3b796ecac506b1ca54217b100795d73a (by RMS) dated 1994, and then there are a couple of subsequent commits of interest: commit aade4ab28e774bc2d74a6567aae24e805f30e78a by Per Bothner in 1995 removed the call to `mouse-set-point' (amongst other changes), and then in 2004 Richard explicitly added it back again: commit 2d7502b55b52b9668c2c920f1bfa5bd437fb3b96 Author: Richard M. Stallman Date: Fri Jan 30 16:53:11 2004 +0000 (term-mouse-paste): Call mouse-set-point. Richard, I've CC'd you on this basis, as it's not clear to me why the `term-mouse-paste' command (which I would expect to do nothing besides send the primary selection text to the inferior process) should be setting point. Do you recall the use-case for that? (n.b. I've attached the above-mentioned commits to this email.) > But if we aren't sure, it's okay to momentarily disable > select-active-regions here, we just need a comment with the > explanation you wrote above. I'm certainly unsure of much of this. I can add that bug#2449 from 2009 is where (deactivate-mark) in `term-send-raw-string' originates, so I think that will be when the `term-mouse-paste' problem I've reported was effectively introduced, as it's the `deactivate-mark' call which causes the primary selection to be updated. The commits for that were: commit c5f894821d04f6fbaf3b8c62308692439ec598d3 2009-03-08 19:33 commit 212bb1a81ade52dcbcbb1bceb680e3e0e0b6264c 2009-03-08 19:37 commit 1cb6d11e13c5e28f96558b85f15344abd56f5e18 2009-03-13 01:43 I haven't read through that bug report, but as `deactivate-mark' was the solution to that, I don't imagine removing that call would be a viable thing to do now, so let-binding `select-active-regions' still feels like a reasonable option for the current problem. >> I'm now looking at that (setq this-command 'yank) as well, and >> wondering whether it's important for anything under the impression >> that a `yank' just happened to also see point at the location of >> the yank. I'm not sure whether a middle click in a terminal to >> send the primary selection directly to the inferior process *should* >> be treated as `yank' though -- maybe that code is also wrong. > > Indeed, we don't by default treat middle click as yank on GUI frames. > So maybe you are right -- but please note that there are some user > options which perhaps do cause the middle click to be treated as yank > as optional behavior, in which case they should do the same in the > term case. This code also dates back to the original implementation of `term-mouse-paste', and bug#6845 from 2010 seems notable for this part. That bug was about `term-mouse-paste' pasting the current kill instead of the primary selection. I don't believe the changes for that are relevant to the *main* problem I've reported, but when the command was pasting from the kill ring the (setq this-command 'yank) call would have made sense, so I suspect this call should have been removed in commit ff98b2dd51e84b812e061859fa8c682d22b2e459 ? All in all: * The (deactivate-mark) in `term-send-raw-string' seems important. * I don't understand the `mouse-set-point' call, but it may be wanted. * Disabling `select-active-regions' in `term-mouse-paste' still seems like the way to go if point is being set (or maybe regardless). * (setq this-command 'yank) looks like an old remnant (now a bug). -Phil (not currently subscribed to the lists; please keep me CC'd) --=_80e76aeb33181c113278f0cfb92f5719 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=term-mouse-paste-mouse-set-point.diff Content-Disposition: attachment; filename=term-mouse-paste-mouse-set-point.diff; size=2569 Y29tbWl0IDJkNzUwMmI1NWI1MmI5NjY4YzJjOTIwZjFiZmE1YmQ0MzdmYjNiOTYKQXV0aG9yOiBS aWNoYXJkIE0uIFN0YWxsbWFuIDxybXNAZ251Lm9yZz4KRGF0ZTogICBGcmkgSmFuIDMwIDE2OjUz OjExIDIwMDQgKzAwMDAKCiAgICAodGVybS1tb3VzZS1wYXN0ZSk6IENhbGwgbW91c2Utc2V0LXBv aW50LgoKZGlmZiAtLWdpdCBhL2xpc3AvdGVybS5lbCBiL2xpc3AvdGVybS5lbAotLS0gYS9saXNw L3Rlcm0uZWwKKysrIGIvbGlzcC90ZXJtLmVsCkBAIC0xMTYzLDE2ICsxMTYzLDE3IEBACgogKGRl ZnVuIHRlcm0tbW91c2UtcGFzdGUgKGNsaWNrIGFyZykKICAgIkluc2VydCB0aGUgbGFzdCBzdHJl dGNoIG9mIGtpbGxlZCB0ZXh0IGF0IHRoZSBwb3NpdGlvbiBjbGlja2VkIG9uLiIKICAgKGludGVy YWN0aXZlICJlXG5QIikKICAgKHRlcm0taWYteGVtYWNzCiAgICAodGVybS1zZW5kLXJhdy1zdHJp bmcgKG9yIChjb25kaXRpb24tY2FzZSAoKSAoeC1nZXQtc2VsZWN0aW9uKSAoZXJyb3IgKCkpKQog CQkJICAgICAoeC1nZXQtY3V0YnVmZmVyKQogCQkJICAgICAoZXJyb3IgIk5vIHNlbGVjdGlvbiBv ciBjdXQgYnVmZmVyIGF2YWlsYWJsZSIpKSkpCiAgICh0ZXJtLWlmbm90LXhlbWFjcwogICAgOzsg R2l2ZSB0ZW1wb3JhcnkgbW9kZXMgc3VjaCBhcyBpc2VhcmNoIGEgY2hhbmNlIHRvIHR1cm4gb2Zm LgogICAgKHJ1bi1ob29rcyAnbW91c2UtbGVhdmUtYnVmZmVyLWhvb2spCiAgICAoc2V0cSB0aGlz LWNvbW1hbmQgJ3lhbmspCisgICAobW91c2Utc2V0LXBvaW50IGNsaWNrKQogICAgKHRlcm0tc2Vu ZC1yYXctc3RyaW5nIChjdXJyZW50LWtpbGwgKGNvbmQKIAkJCQkJKChsaXN0cCBhcmcpIDApCiAJ CQkJCSgoZXEgYXJnICctKSAtMSkKIAkJCQkJKHQgKDEtIGFyZykpKSkpKSkKCgoKCmNvbW1pdCBh YWRlNGFiMjhlNzc0YmMyZDc0YTY1NjdhYWUyNGU4MDVmMzBlNzhhCkF1dGhvcjogUGVyIEJvdGhu ZXIgPGJvdGhuZXJAY3lnbnVzLmNvbT4KRGF0ZTogICBUaHUgTWFyIDE2IDAyOjIzOjI0IDE5OTUg KzAwMDAKCiAgICAodGVybS1tb3VzZS1wYXN0ZSk6ICBNYWtlIHdvcmsgZm9yIHhlbWFjcy4gIE1p bm9yIEdOVSBlbWFjcyBmaXhlcy4KCmRpZmYgLS1naXQgYS9saXNwL3Rlcm0uZWwgYi9saXNwL3Rl cm0uZWwKLS0tIGEvbGlzcC90ZXJtLmVsCisrKyBiL2xpc3AvdGVybS5lbApAQCAtNjY5LDEwICs2 NjksMTYgQEAKCiAoZGVmdW4gdGVybS1tb3VzZS1wYXN0ZSAoY2xpY2sgYXJnKQogICAiSW5zZXJ0 IHRoZSBsYXN0IHN0cmV0Y2ggb2Yga2lsbGVkIHRleHQgYXQgdGhlIHBvc2l0aW9uIGNsaWNrZWQg b24uIgogICAoaW50ZXJhY3RpdmUgImVcblAiKQotICAobW91c2Utc2V0LXBvaW50IGNsaWNrKQot ICAoc2V0cSB0aGlzLWNvbW1hbmQgJ3lhbmspCi0gICh0ZXJtLXNlbmQtcmF3LXN0cmluZyAoY3Vy cmVudC1raWxsIChjb25kCi0JCQkJICAgICAgICgobGlzdHAgYXJnKSAwKQotCQkJCSAgICAgICAo KGVxIGFyZyAnLSkgLTEpCi0JCQkJICAgICAgICh0ICgxLSBhcmcpKSkpKSkKKyAgKHRlcm0taWYt eGVtYWNzCisgICAodGVybS1zZW5kLXJhdy1zdHJpbmcgKG9yIChjb25kaXRpb24tY2FzZSAoKSAo eC1nZXQtc2VsZWN0aW9uKSAoZXJyb3IgKCkpKQorCQkJICAgICAoeC1nZXQtY3V0YnVmZmVyKQor CQkJICAgICAoZXJyb3IgIk5vIHNlbGVjdGlvbiBvciBjdXQgYnVmZmVyIGF2YWlsYWJsZSIpKSkp CisgICh0ZXJtLWlmbm90LXhlbWFjcworICAgOzsgR2l2ZSB0ZW1wb3JhcnkgbW9kZXMgc3VjaCBh cyBpc2VhcmNoIGEgY2hhbmNlIHRvIHR1cm4gb2ZmLgorICAgKHJ1bi1ob29rcyAnbW91c2UtbGVh dmUtYnVmZmVyLWhvb2spCisgICAoc2V0cSB0aGlzLWNvbW1hbmQgJ3lhbmspCisgICAodGVybS1z ZW5kLXJhdy1zdHJpbmcgKGN1cnJlbnQta2lsbCAoY29uZAorCQkJCQkoKGxpc3RwIGFyZykgMCkK KwkJCQkJKChlcSBhcmcgJy0pIC0xKQorCQkJCQkodCAoMS0gYXJnKSkpKSkpKQoKCgoKQW5kIHBh cnQgb2YgY29tbWl0IDQwNjBlNmVlM2I3OTZlY2FjNTA2YjFjYTU0MjE3YjEwMDc5NWQ3M2E6CkF1 dGhvcjogUmljaGFyZCBNLiBTdGFsbG1hbiA8cm1zQGdudS5vcmc+CkRhdGU6ICAgVGh1IE9jdCAx MyAwNjozMDo0OSAxOTk0ICswMDAwCgogICAgSW5pdGlhbCByZXZpc2lvbgoKZGlmZiAtLWdpdCBh L2xpc3AvdGVybS5lbCBiL2xpc3AvdGVybS5lbAotLS0gL2Rldi9udWxsCisrKyBiL2xpc3AvdGVy bS5lbApAQCAtMCwwICs2NDEsMTAgQEAKKworKGRlZnVuIHRlcm0tbW91c2UtcGFzdGUgKGNsaWNr IGFyZykKKyAgIkluc2VydCB0aGUgbGFzdCBzdHJldGNoIG9mIGtpbGxlZCB0ZXh0IGF0IHRoZSBw b3NpdGlvbiBjbGlja2VkIG9uLiIKKyAgKGludGVyYWN0aXZlICJlXG5QIikKKyAgKG1vdXNlLXNl dC1wb2ludCBjbGljaykKKyAgKHNldHEgdGhpcy1jb21tYW5kICd5YW5rKQorICAodGVybS1zZW5k LXJhdy1zdHJpbmcgKGN1cnJlbnQta2lsbCAoY29uZAorCQkJCSAgICAgICAoKGxpc3RwIGFyZykg MCkKKwkJCQkgICAgICAgKChlcSBhcmcgJy0pIC0xKQorCQkJCSAgICAgICAodCAoMS0gYXJnKSkp KSkpCg== --=_80e76aeb33181c113278f0cfb92f5719-- From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 14 10:28:29 2023 Received: (at 58608) by debbugs.gnu.org; 14 Mar 2023 14:28:29 +0000 Received: from localhost ([127.0.0.1]:38206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pc5dd-0005zh-3M for submit@debbugs.gnu.org; Tue, 14 Mar 2023 10:28:29 -0400 Received: from smtp-3.orcon.net.nz ([60.234.4.44]:52417) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pc5db-0005zZ-Iy for 58608@debbugs.gnu.org; Tue, 14 Mar 2023 10:28:28 -0400 Received: from [10.253.37.70] (port=58282 helo=webmail.orcon.net.nz) by smtp-3.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1pc5dZ-0001iD-9d; Wed, 15 Mar 2023 03:28:25 +1300 Received: from ip-180-148-124-51.kinect.net.nz ([180.148.124.51]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 15 Mar 2023 03:28:25 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 15 Mar 2023 03:28:25 +1300 From: Phil Sainty To: Eli Zaretskii Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <628154950d12e3e6c6989ae14f843bbb@webmail.orcon.net.nz> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> <835ygfys2k.fsf@gnu.org> <628154950d12e3e6c6989ae14f843bbb@webmail.orcon.net.nz> Message-ID: <6a98841477c47774d2e2c5621a000b42@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org, "Richard M. Stallman" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2023-03-15 01:46, Phil Sainty wrote: > when the command was pasting from the kill ring the > (setq this-command 'yank) call would have made sense On second thought, I'm not sure it made any sense then either -- that "paste" was still sending the text to the inferior process rather than inserting it into the buffer, and it's entirely up to the process as to whether anything at all gets inserted into the buffer as a result, so I don't think of that as a `yank' as far as Emacs is concerned. (I'd still hazard a guess that (setq this-command 'yank) was added on account of dealing with the kill ring, but perhaps it was just a mistake all along.) -Phil From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 16 03:18:09 2023 Received: (at 58608) by debbugs.gnu.org; 16 Mar 2023 07:18:09 +0000 Received: from localhost ([127.0.0.1]:41093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pchsH-0001hD-7S for submit@debbugs.gnu.org; Thu, 16 Mar 2023 03:18:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pchsF-0001h0-G1 for 58608@debbugs.gnu.org; Thu, 16 Mar 2023 03:18:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pchs9-00067Y-J8; Thu, 16 Mar 2023 03:18:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cpK1dFtAf7iFxR2IQGTmznWRz/Wws25i6oz6hCqWUWY=; b=H2Hs6Amc7uZp AThPZ8nBXPz1FwZd8PtjbOyvHSYxdtX3mw3HXL+x7N561KMlXJt7xmZrbwU+v2dMfNz0dbZHaHZDo USmggIp4GGOV5NYQnaMLy209fjUjllSoOW4O5fonGUURwXuIx/XUhJFEqm2f7tUZFh3q8xD9OZm7o 8rCJEgXdyOU8gOiFKiBvVaRT156O2lKhCjY3ZwsKXn1BbRXi8F0v9sBlL3NF3+ijJo3HBGJTsq/sX RpNIj3JgcopESMZQ6FoshTxbNeNeJdpIF++FKlkBnDeMgT/fv7tKPC3E004Rf4Y9eqDMzwKHERIlC TuBtER5psSiI1sGmjW8Cjg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pchrq-0007WC-AB; Thu, 16 Mar 2023 03:17:44 -0400 Date: Thu, 16 Mar 2023 09:17:39 +0200 Message-Id: <83cz59qi5o.fsf@gnu.org> From: Eli Zaretskii To: Phil Sainty In-Reply-To: <6a98841477c47774d2e2c5621a000b42@webmail.orcon.net.nz> (message from Phil Sainty on Wed, 15 Mar 2023 03:28:25 +1300) Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> <835ygfys2k.fsf@gnu.org> <628154950d12e3e6c6989ae14f843bbb@webmail.orcon.net.nz> <6a98841477c47774d2e2c5621a000b42@webmail.orcon.net.nz> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org, rms@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 15 Mar 2023 03:28:25 +1300 > From: Phil Sainty > Cc: 58608@debbugs.gnu.org, "Richard M. Stallman" > > On 2023-03-15 01:46, Phil Sainty wrote: > > when the command was pasting from the kill ring the > > (setq this-command 'yank) call would have made sense > > On second thought, I'm not sure it made any sense then either -- that > "paste" was still sending the text to the inferior process rather than > inserting it into the buffer, and it's entirely up to the process as > to whether anything at all gets inserted into the buffer as a result, > so I don't think of that as a `yank' as far as Emacs is concerned. > > (I'd still hazard a guess that (setq this-command 'yank) was added on > account of dealing with the kill ring, but perhaps it was just a mistake > all along.) Thanks for all the forensics. I think we should install on emacs-29 a change that binds select-active-regions to nil around the call to term-send-raw-string, and install on master a change that removes the setting of this-command. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 26 08:45:24 2023 Received: (at 58608) by debbugs.gnu.org; 26 Mar 2023 12:45:24 +0000 Received: from localhost ([127.0.0.1]:44242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgPkR-000822-NS for submit@debbugs.gnu.org; Sun, 26 Mar 2023 08:45:23 -0400 Received: from smtp-3.orcon.net.nz ([60.234.4.44]:45897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgPkP-00081s-Ki for 58608@debbugs.gnu.org; Sun, 26 Mar 2023 08:45:22 -0400 Received: from [10.253.37.70] (port=13415 helo=webmail.orcon.net.nz) by smtp-3.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1pgPkN-0005Vf-Bb; Mon, 27 Mar 2023 01:45:19 +1300 Received: from ip-180-148-124-51.kinect.net.nz ([180.148.124.51]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Mon, 27 Mar 2023 01:45:19 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 27 Mar 2023 01:45:19 +1300 From: Phil Sainty To: Eli Zaretskii Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers In-Reply-To: <83cz59qi5o.fsf@gnu.org> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> <835ygfys2k.fsf@gnu.org> <628154950d12e3e6c6989ae14f843bbb@webmail.orcon.net.nz> <6a98841477c47774d2e2c5621a000b42@webmail.orcon.net.nz> <83cz59qi5o.fsf@gnu.org> Message-ID: <1882aa49380cc5e12186928345f5ed84@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org, rms@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2023-03-16 20:17, Eli Zaretskii wrote: > I think we should install on emacs-29 a change that binds > select-active-regions to nil around the call to term-send-raw-string, > and install on master a change that removes the setting of > this-command. I've installed those changes to emacs-29 and master accordingly. The question of why this command sets point in the first place is still outstanding, but I think we'd need a follow-up from Richard to establish the reason behind that. In any case, the major issue is now resolved for Emacs 29+. I'd happily fix it in the emacs-28 branch as well, on the offchance that doing so might help someone (as this issue can be harmful if you're unlucky enough to trigger it); but if that's a no-go then I think this can be closed. -Phil From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 26 09:47:56 2023 Received: (at 58608) by debbugs.gnu.org; 26 Mar 2023 13:47:56 +0000 Received: from localhost ([127.0.0.1]:44298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgQiy-0003fJ-FD for submit@debbugs.gnu.org; Sun, 26 Mar 2023 09:47:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgQiw-0003eT-R4 for 58608@debbugs.gnu.org; Sun, 26 Mar 2023 09:47:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgQiq-0000pA-4U; Sun, 26 Mar 2023 09:47:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3HBh+8rv3B5aM1O2JI0aZ09YN/DmPVK7eBPWJnNrCis=; b=JElHeBE79g9I +Dxi/yBrcPx8jOPm6RmJJPxn7rXVqVwkFflehqTUQAXAEE6Jusu7nCQtRqbfQdIH9Nj4k6fPlIs0D 2+ejja/y+3mGPp6dVveRZFUbRDZFfjWEVmozGg/OPqDLvnmWc419bwl7HRG4D3eSK0MA6cmCTnidh 0w+9HwuC8JIyRhS58jyTCEimMzouUg5k5E/9CzRzY6OzroUt4FWppeucg22827NlPmlvFZB0H3kyV yTBbUQ5k4IsiVKBRNaeugwb13HhWgxcq9G8qGyH/UBubxzzSJ8Wn4UfxLhxWVwPVqy0zopDhWghsm vlB08B/EomJ2FkDQfbeflw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgQij-0003fE-OJ; Sun, 26 Mar 2023 09:47:42 -0400 Date: Sun, 26 Mar 2023 16:47:40 +0300 Message-Id: <83pm8vaakj.fsf@gnu.org> From: Eli Zaretskii To: Phil Sainty , Stefan Kangas In-Reply-To: <1882aa49380cc5e12186928345f5ed84@webmail.orcon.net.nz> (message from Phil Sainty on Mon, 27 Mar 2023 01:45:19 +1300) Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> <835ygfys2k.fsf@gnu.org> <628154950d12e3e6c6989ae14f843bbb@webmail.orcon.net.nz> <6a98841477c47774d2e2c5621a000b42@webmail.orcon.net.nz> <83cz59qi5o.fsf@gnu.org> <1882aa49380cc5e12186928345f5ed84@webmail.orcon.net.nz> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org, rms@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 27 Mar 2023 01:45:19 +1300 > From: Phil Sainty > Cc: 58608@debbugs.gnu.org, rms@gnu.org > > In any case, the major issue is now resolved for Emacs 29+. I'd > happily fix it in the emacs-28 branch as well, on the offchance > that doing so might help someone (as this issue can be harmful if > you're unlucky enough to trigger it); but if that's a no-go then > I think this can be closed. This is up to Stefan Kangas. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 26 09:49:11 2023 Received: (at 58608) by debbugs.gnu.org; 26 Mar 2023 13:49:11 +0000 Received: from localhost ([127.0.0.1]:44308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgQkB-0003k0-3c for submit@debbugs.gnu.org; Sun, 26 Mar 2023 09:49:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgQk9-0003jo-Ub for 58608@debbugs.gnu.org; Sun, 26 Mar 2023 09:49:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgQk4-0000uL-Ms; Sun, 26 Mar 2023 09:49:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=IMf0L56jDkgZWNBMOk05gFlV1Lq3igaEoSIWqqQUvn0=; b=UVji2Sys8l+A QkiVErNUJoDZueYqf9PKlZzlU45Cfb0AEIvpKBTxDRhsiGW6cUGtjnnYNZw84pvp4gaeqo2NS/tyO BaXAI0IfnPa0vWk2xv98N/otcHyE/leH99KhfHMm+t7Q8+gc61XXpQw8hCOfC96yfXlR9vvakfx/H Rc2jTr7q0UwM3c4qtFjntcxYabkqyx2kf2SyU6xzFnig5GNUqjp62lzVWXNpnz8QDDXa17Eo180ye T6Io+eNujB2UmuZb8ZfXEHWENPnUdFFiVNtRt97T+DCPN4oURWx8esb807ppxbzxLXy7vKYVFnzP8 nZvsNlAZwBLZEmyzvBISpQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgQjy-0003pf-Lc; Sun, 26 Mar 2023 09:48:58 -0400 Date: Sun, 26 Mar 2023 16:48:59 +0300 Message-Id: <83o7ofaaic.fsf@gnu.org> From: Eli Zaretskii To: Phil Sainty In-Reply-To: <1882aa49380cc5e12186928345f5ed84@webmail.orcon.net.nz> (message from Phil Sainty on Mon, 27 Mar 2023 01:45:19 +1300) Subject: Re: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <83ilkgysxo.fsf@gnu.org> <2e5596b526f1cf77da9e162dc2cb8566@webmail.orcon.net.nz> <835ygfys2k.fsf@gnu.org> <628154950d12e3e6c6989ae14f843bbb@webmail.orcon.net.nz> <6a98841477c47774d2e2c5621a000b42@webmail.orcon.net.nz> <83cz59qi5o.fsf@gnu.org> <1882aa49380cc5e12186928345f5ed84@webmail.orcon.net.nz> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58608 Cc: 58608@debbugs.gnu.org, rms@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 27 Mar 2023 01:45:19 +1300 > From: Phil Sainty > Cc: 58608@debbugs.gnu.org, rms@gnu.org > > On 2023-03-16 20:17, Eli Zaretskii wrote: > > I think we should install on emacs-29 a change that binds > > select-active-regions to nil around the call to term-send-raw-string, > > and install on master a change that removes the setting of > > this-command. > > I've installed those changes to emacs-29 and master accordingly. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 01 13:23:06 2023 Received: (at control) by debbugs.gnu.org; 1 Oct 2023 17:23:06 +0000 Received: from localhost ([127.0.0.1]:35232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qn09q-0007VT-3o for submit@debbugs.gnu.org; Sun, 01 Oct 2023 13:23:06 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:56634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qn09o-0007Ut-7l for control@debbugs.gnu.org; Sun, 01 Oct 2023 13:23:04 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5041bb9ce51so24237630e87.1 for ; Sun, 01 Oct 2023 10:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696180962; x=1696785762; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=VzKh6BrV/kRVk4XCMXNF108zT7KJ8udOm58CLEs+ZiY=; b=AMAPpO3seJslTeoSlT9NMKS0w01oHrEKH0n3qhVe/lnQGQn2jBusXifS7FlWtOaikz TauiAwmJ7/3lMsn3WZdrXxfVtCKGHcwB2QiksoO8+YTJg5VqJolAPSmtAZAHmZpUkMwP 5Fd1mwvxT4sxJ0VPI//eoblFmoJDrQHIEp0WrVhcFluSsGIY+aSvHyDvn/ucfDw2bCfo Ab1JKi7ayfwzGkYyCYQiBlwJRiDR4y0SIBU8wGhQoA64D7aTAJh7r6eHXvdGEh4aSXj9 UGwEctsb/a6YTTxr5xZ7CSXAf3MS5SiZ5lxrWExxYYhCN+twzN1JH/peoXvPJMO5POWV DRcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696180962; x=1696785762; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=VzKh6BrV/kRVk4XCMXNF108zT7KJ8udOm58CLEs+ZiY=; b=VxJsLPgtwejjvbbGzVIitJC4KnK8OJja/b0fFu+/t+CXwzo/LnFTml6IW9HeokD9mu 6zVMsQQicB6s0qyQTmRGOQXeh0cEYff4ahK7wkcwfw6ge7o3WRsKxOcybnHw0Um9UhWQ fz8IzoOnguLMvdb3LP3xlOh1Gl8F4TwkoJsjryV3r0TgIoQe+Jtv8QMpLB6eIat/6EoE q8hkG62IQVl1gCAntUMnpYbUYBFelrPtiNruMhQwS3eTMDj9vmZPPNtweM72h5SwfuSl Ye+zUUetyTbrYwuxbjmYrRiSEA1eEYBgQPwMpWgCkHJoevHP00cmRwTzwacrf7MCMvSX a4zA== X-Gm-Message-State: AOJu0YxXj/Tw6D1mB42GfMMzt7m/00vWem3evGHC0qEyakNegrVB0BR4 9wxB6hWpgkjIqtp6kVmRWqaOp3E3H3XN8AankyTdTBZaZac= X-Google-Smtp-Source: AGHT+IGZhjGCzObuZP6Eu5LXuVEhnro/S4HqtskPB9TtNyqyl6FtZ71QPwROoQK3Dlx8dQHrd814o4CGBeFlbpOB7I4= X-Received: by 2002:a05:6512:1388:b0:500:97e4:587e with SMTP id fc8-20020a056512138800b0050097e4587emr10140017lfb.44.1696180961495; Sun, 01 Oct 2023 10:22:41 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 1 Oct 2023 10:22:41 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Sun, 1 Oct 2023 10:22:41 -0700 Message-ID: Subject: control message for bug #58608 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 58608 29.1 quit From unknown Fri Jun 20 05:26:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 30 Oct 2023 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator