From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#13692: mouse clicks in vc-dir buffers accidentally changing marks Date: Sun, 24 Jan 2021 04:23:43 +0200 Message-ID: <47d355fe-e472-dc0d-fead-a1450849afc6@yandex.ru> References: <875z3suun0.fsf@gnus.org> <87o8hijql0.fsf@gnus.org> <927a3c2e-bd77-df54-303c-e9c098f5d244@yandex.ru> <875z3nv5lq.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------CBE7F39E17A289E3ECE1CADA" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28749"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: Glenn Morris , 13692@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 24 03:24:28 2021 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 1l3V4m-0007Ma-7r for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Jan 2021 03:24:28 +0100 Original-Received: from localhost ([::1]:58312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3V4l-0000MN-Ao for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Jan 2021 21:24:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3V4R-0000Lk-2n for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2021 21:24:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52382) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3V4L-0001tZ-RP for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2021 21:24:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l3V4L-0004cS-Mk for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2021 21:24:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Jan 2021 02:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13692 X-GNU-PR-Package: emacs Original-Received: via spool by 13692-submit@debbugs.gnu.org id=B13692.161145503417743 (code B ref 13692); Sun, 24 Jan 2021 02:24:01 +0000 Original-Received: (at 13692) by debbugs.gnu.org; 24 Jan 2021 02:23:54 +0000 Original-Received: from localhost ([127.0.0.1]:35695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3V4E-0004c7-0N for submit@debbugs.gnu.org; Sat, 23 Jan 2021 21:23:54 -0500 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:39165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3V4C-0004bv-Pq for 13692@debbugs.gnu.org; Sat, 23 Jan 2021 21:23:53 -0500 Original-Received: by mail-wr1-f45.google.com with SMTP id a1so8801330wrq.6 for <13692@debbugs.gnu.org>; Sat, 23 Jan 2021 18:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=uvPbY/bwpcbhFPpnh637AqSKqtv53G0ctVzjIMNlMHw=; b=iZzg69rPJPeK3tFu0lnPNmT39XcYfTXqg5vedRfVijwJSl2GOWuvSKjaADVCU74UJW tGX7a+FeZSzE4Q2q9WBqpzNdQwijfXqylp1dL5yMLKAH3xksUaCvhoaPDncOM1x6S7o6 tQbATN9VCqiHwJERNsQ6eibZce0k7dpYgEl55CQO70c+Cx6RpogKB1a0CHYMMxoy0RhE DM/CKP4Iwhlk1/ZLywhX/rpk5EYcrVMUHLyCEuG1N3K8wEHF4RoNDUTi9aV5Tb+9iK/5 WZQfaFIKCTTt4itp6NfsrhKoaFxGuSsMCEgwJsSj/MNfk8RBdPRTQqe/fbBy8hhJIIIa uilQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=uvPbY/bwpcbhFPpnh637AqSKqtv53G0ctVzjIMNlMHw=; b=qYDmPZRzAPSUyg40l8bgdDkSP1SVDz8XwIRvUkzXq1IBcEb0Yqmg3PY8SrMzi8TXV4 ztURACbKo81JN5D+d56Q2q58RUW25BpzQqbkzWMGiiq15v6zBtpMOXhMesUZ92kd+vrf P4n7fRdb4ShGn2LV1qjexJpuVuewWYMsJi7FKu1kz3kEpjt8keUUr26OfrJtIJuuN2vu ndGFtKrsUL/hdD/aT9QpgpXjV4z0+cqquKVxbP1u5DSq3AYHaydqxA9tC5VU623W/xWv aHNv0K5pIrN5eBwo5aN5UlmvEMtjK2oGKimcITpmZq2ZvWYRE4F+J3cHuC3JUAytKN7A ndPg== X-Gm-Message-State: AOAM53335EyJQadZ+RvgcDBitS2+5lzB9pa4CsZrCXd+QfsH62qZrGaS Sg8/2oQxb7DWRzzeMtkP/50Rd2gmmWI= X-Google-Smtp-Source: ABdhPJy4GFk6AKbnSdY8JwJ5ECyUaUe2h8C1FCrjkliryJJAMdRwayhiDJP+kcZSJuTxRFyjj1oJvw== X-Received: by 2002:a5d:5049:: with SMTP id h9mr1064721wrt.404.1611455026764; Sat, 23 Jan 2021 18:23:46 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id k6sm6608462wro.27.2021.01.23.18.23.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Jan 2021 18:23:45 -0800 (PST) In-Reply-To: <875z3nv5lq.fsf@gnus.org> Content-Language: en-US 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:198491 Archived-At: This is a multi-part message in MIME format. --------------CBE7F39E17A289E3ECE1CADA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 23.01.2021 21:02, Lars Ingebrigtsen wrote: > Dmitry Gutov writes: > >> We're talking about slightly different things. >> >> When I hear "mouse-2 binding", I think the global bidning in >> vc-dir-mode-map, which affects how mouse-2 works also when clicking >> outside of any buttons (on whitespace beside the buttons). And I think >> that behavior is relatively weird and could be removed. > > I didn't even notice that `mouse-2' did stuff when outside the > "buttons". And what it does is quite odd... hm, no, if you click after > the final line, it'll mark the last line, and before the first, it'll > mark the first, so perhaps that's logical? I meant more like between the buttons, but on the same line as them. The "before" and "after" behaviors are logical, but the whole binding is very non-discoverable. Nor does it work on file names. >> But we also have the behavior of mouse-1 and mouse-2 clicks on the >> "status" button. Which seem fairly sensible to me, but might be the >> cause of Glenn's annoyance in this report because it's relatively easy >> to click mouse-1 anywhere in the buffer by mistake. > > Yes, I think he was complaining about the "status" button. > >> Right. But if that is what is at issue here, I think the question >> becomes whether to remove the "buttons" from that column (and keep the >> mouse-2 binding globally) or whether to remove the mouse-2 binding, >> but set up the buttons to continue working. Or make mouse-1 stop >> working on the buttons but keep mouse-2 working everywhere (except the >> file names, I guess?). > > I think removing the global mouse bindings and only having them on the > "buttons" would be least surprising -- that's how most modes work. The attached patch seems to do that, except for the "status" buttons beside directory names, which seem to be printed by ewoc in some other way, and thus don't go through vc-dir-printer. Which is a new different kind of awkward. We're also solving a different problem than the one which was reported. So I'm not sure about the change, TBH. --------------CBE7F39E17A289E3ECE1CADA Content-Type: text/x-patch; charset=UTF-8; name="vc-dir-no-mouse-2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vc-dir-no-mouse-2.diff" diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index bbb73240be..9d0808c043 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -300,7 +300,6 @@ vc-dir-mode-map (define-key map "\C-o" 'vc-dir-display-file) (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process) (define-key map [down-mouse-3] 'vc-dir-menu) - (define-key map [mouse-2] 'vc-dir-toggle-mark) (define-key map [follow-link] 'mouse-face) (define-key map "x" 'vc-dir-hide-up-to-date) (define-key map [?\C-k] 'vc-dir-kill-line) @@ -1085,7 +1084,6 @@ vc-dir-mode as the current file - if the cursor is on a directory: unmark all child files - with a prefix argument: unmark all files -mouse-2 - toggles the mark state VC commands VC commands in the `C-x v' prefix can be used. @@ -1392,6 +1390,12 @@ vc-default-dir-extra-headers (propertize "Please add backend specific headers here. It's easy!" 'face 'font-lock-warning-face))) +(defvar vc-dir-status-mouse-map + (let ((map (make-sparse-keymap))) + (define-key map [mouse-2] 'vc-dir-toggle-mark) + map) + "Local keymap for toggling mark.") + (defvar vc-dir-filename-mouse-map (let ((map (make-sparse-keymap))) (define-key map [mouse-2] 'vc-dir-find-file-other-window) @@ -1418,7 +1422,8 @@ vc-default-dir-printer ((memq state '(missing conflict)) 'font-lock-warning-face) ((eq state 'edited) 'font-lock-constant-face) (t 'font-lock-variable-name-face)) - 'mouse-face 'highlight) + 'mouse-face 'highlight + 'keymap vc-dir-status-mouse-map) " " (propertize (format "%s" filename) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index a9ee28e3aa..94fac3a83b 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -481,7 +481,8 @@ vc-git-dir-printer 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face) ((eq state 'missing) 'font-lock-warning-face) (t 'font-lock-variable-name-face)) - 'mouse-face 'highlight) + 'mouse-face 'highlight + 'keymap vc-dir-status-mouse-map) " " (vc-git-permissions-as-string old-perm new-perm) " " (propertize (vc-git-escape-file-name (vc-dir-fileinfo->name info)) --------------CBE7F39E17A289E3ECE1CADA--