From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adolf Mathias Newsgroups: gmane.emacs.bugs Subject: bug#34014: 25.2; binding down mouse event with modifier to mouse-drag-region does not work Date: Fri, 14 Aug 2020 20:58:41 +0200 Message-ID: References: <83pnrbhvna.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35896"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 34014@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 14 20:59:14 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6ev3-0009DO-Sb for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Aug 2020 20:59:13 +0200 Original-Received: from localhost ([::1]:34682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ev2-0002hr-VB for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Aug 2020 14:59:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6eus-0002hi-Op for bug-gnu-emacs@gnu.org; Fri, 14 Aug 2020 14:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42319) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6eus-0001Vr-Fu for bug-gnu-emacs@gnu.org; Fri, 14 Aug 2020 14:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k6eus-000073-FQ for bug-gnu-emacs@gnu.org; Fri, 14 Aug 2020 14:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Adolf Mathias Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Aug 2020 18:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34014 X-GNU-PR-Package: emacs Original-Received: via spool by 34014-submit@debbugs.gnu.org id=B34014.1597431541426 (code B ref 34014); Fri, 14 Aug 2020 18:59:02 +0000 Original-Received: (at 34014) by debbugs.gnu.org; 14 Aug 2020 18:59:01 +0000 Original-Received: from localhost ([127.0.0.1]:53865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6euq-00006n-CP for submit@debbugs.gnu.org; Fri, 14 Aug 2020 14:59:01 -0400 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:50214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6euo-00006Q-NR for 34014@debbugs.gnu.org; Fri, 14 Aug 2020 14:58:59 -0400 Original-Received: by mail-wm1-f43.google.com with SMTP id c80so8296457wme.0 for <34014@debbugs.gnu.org>; Fri, 14 Aug 2020 11:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7kU8v+wXPNhLhpnSV5o0pMOwELkJsX15IsVnnf2nUrs=; b=s7GQKJHWxftC+0bfNEEEj5E143fWN2NxcOp0tdeJ2LZjSqUWKtM1tavnOW/pC3hZrZ yuF4hsctulBJ9IVOqndF4tsutc754NmYBohlcjM3AzvOheo2VCo+sg176jrSO2b0BFju V69zf/CtJlQIf6+kt7NE6mPheyzT+gS7z5Dlxhv+ko3Tgt6xFbTwrbG1U+1NGqQ8Sd1W sxbGvROB3lLPxJ2c7ekl88ZCZrVytcvca3q7891zQUCNhjJ9y5cxM4VUs7A29lU5XupZ NhUgcp8VbU1koaxPbeYKNYK1eyCA/jVHLbusb7sg7Misqn5+kKJDGZTpYL/muxOauWLt H7rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7kU8v+wXPNhLhpnSV5o0pMOwELkJsX15IsVnnf2nUrs=; b=D+NYIcYJXO04OY09ygBB/3OCqq7zwxiT/2UpUgBCHBJi++RltVO1CqzHvA5QEK3xU/ dpIE/0DHAm0aqYqd46gaFyganBA+vJRPsmlxIhWRYnyAW8HShu6zImPcFv7WoTumNyPa x+FzhrChTg9qVK9fdWDMCx7bMRDxQ20il+4BeUgbuirzNnYpHgghftxVhiphnfj3+ekr lLjcnBIFvu3od003O7IzvG4TpaQPvRHpaySNUa1plgLwZUSmy0BAqu0EOULAiQCUqRvn 4fAR7FILzH1f9MEB+QpnLer08XTtGpiC3XccFJrUk8nd+1mTlaS6kmuo15VYudx/ce1a QdYg== X-Gm-Message-State: AOAM531SQIEvpRriRiqclqy9vT1jmcTJ7z5crpsezbYUYdRkCMNm2Jjm LeuCpakC8brl79xcgndD/AHeJyfn0Mhae71QXfrkrtKtPbA= X-Google-Smtp-Source: ABdhPJw13hjpxeWEB+e1iWLaqP3qEPhty1gLiNbzY16kYXcT0BFw/iuCkYIJ6YVnEVoyYgV9fDQHtJ74oD0uVL9HIdw= X-Received: by 2002:a1c:9803:: with SMTP id a3mr3551894wme.57.1597431532665; Fri, 14 Aug 2020 11:58:52 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:185154 Archived-At: Yes, your two expressions works on emacs-27.1 which I just installed with snap on an Ubuntu 18.04, dragging S-mouse1 sets the region like mouse-1. The thing is, on Emacs24 and before I had the following working code: ========================== (defun mouse-stay-and-copy (click) "leaves cursor at current position, allows to drag a region which is yanked at cursor position" (interactive "e") (let ((selected nil) (win (selected-window)) (otherwin nil) (otherstart nil) (eventstart nil)) (save-excursion (setq eventstart (event-start click)) (setq otherwin (car eventstart)) (setq otherstart (window-start otherwin)) (mouse-drag-track click) (if mark-active (progn (kill-new (buffer-substring (region-beginning) (region-end))) (setq selected 1) ))) (select-window win) (if selected (progn (if mark-active (delete-region (region-beginning) (region-end))) (yank) ;;(redraw-display) )) (set-window-start otherwin otherstart nil))) (define-key global-map '[S-down-mouse-1] 'mouse-stay-and-copy) ========================== On Emacs Post 24, this stopped to work. When I filed the bug report, I reduced this to a builtin Emacs function. On Emacs 24, to bind Shift-mouse1, only the following call is required: (define-key global-map '[S-down-mouse-1] 'mouse-drag-region) My mouse-stay-and-copy is just a fancy replacement for mouse-drag-region. Sadly, its API in conjunction with mouse-drag-track has changed mysteriously with post-24. On Fri, Aug 14, 2020 at 4:29 PM Stefan Kangas wrote: > > reopen 34014 > thanks > > Hi Adolf, > > [Please use "Reply to all" so that the discussion is recorded in the bug > tracker.] > > Adolf Mathias writes: > > > Sorry for the apparent delay. I myself got a bit frustrated with the > > issue and rewrote a simple version of mouse-drag-region for myself > > which does not deal with double/triple-clicks acting on words and > > lines however. I was not able to disentangle what Emacs does there. > > I somehow was convinced that I had answered back then why I wanted to > > bind mouse-drag-region to a button-down event. > > I did so because the Emacs help on mouse-drag-region told me so, and > > because it used to work that way. > > Thanks for replying back. I am therefore reopening this bug. > With your help, we could try to figure out what is going on here. > > Does it work like you expect if you evaluate this in emacs -Q? > > (define-key global-map '[S-down-mouse-1] 'mouse-drag-region) > (define-key global-map '[S-drag-mouse-1] 'mouse-set-region) > > If that does not help, could you please try to describe the use-case in > more detail and explain what it is you're trying to achieve? > > Thanks in advance. > > Best regards, > Stefan Kangas