From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: CUA mode C-c overridden by keymap text property Date: Mon, 30 Dec 2019 18:17:38 +0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="49809"; mail-complaints-to="usenet@blaine.gmane.org" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 30 12:18:13 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ilt3q-000CoR-WE for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Dec 2019 12:18:11 +0100 Original-Received: from localhost ([::1]:60536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilt3p-0004FS-6g for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Dec 2019 06:18:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36285) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilt3b-0004FM-0g for help-gnu-emacs@gnu.org; Mon, 30 Dec 2019 06:17:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilt3Y-0008NX-SU for help-gnu-emacs@gnu.org; Mon, 30 Dec 2019 06:17:54 -0500 Original-Received: from mail-ua1-x932.google.com ([2607:f8b0:4864:20::932]:37956) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ilt3Y-0008N9-Mr for help-gnu-emacs@gnu.org; Mon, 30 Dec 2019 06:17:52 -0500 Original-Received: by mail-ua1-x932.google.com with SMTP id c7so8065452uaf.5 for ; Mon, 30 Dec 2019 03:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=s3CasWRXx5EzBScxvz+VTWS3JMyXqKXdoGatdbjulc8=; b=BSPFlzpRp3kqWj9vmX/hZ2cFpTLmfx7reNMnffF1VB709gFxyhagCmiLSFGLHDVBe6 yPz7bP40KH3pLbFpZ1XSTzG7sPBMvIzcKuwoLye4HzdjkR4Z0OOFufq01m+7HTa1svge mr0D+ZgL+LBHjvdCC8k6DPvHZ/RZKw9n5L1x9DV51IVd7T0Mo8xzLJHf6z8YIwZRn1Ec 2QHbEicCA6dqlva5k/1wPDByh2zOmszrG/zeYkXx5n7rJIDKC7kA74BY16EWbR57tYUq vOcSyIGWNK6aBJ4ilee6JPFm7dHlaw8dVTRIiy9GM+d8HlGqEo67EkBD/g+2m1k6PwDA KfQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=s3CasWRXx5EzBScxvz+VTWS3JMyXqKXdoGatdbjulc8=; b=QTCvHwS4c2OYEi7gqxl4HVegXtd84ngktK6aJ2ZVdCMOWyNIjpu3/zc+rObHh/ETOT LmatoR0gxNzMoM3ysM3C4cvwMIj4j0BnMqSvvXwikB9oMTbrCqccLHmPo0rUN9KhwpAm vKhybyKM4S37jYncNfBi531iQJwU0BGa8ASRLMkkunXHrpG4Xm6hzwkOzYscII6kDIIN pky5pCf+Na3IWMWZjwl/bMOzFuDSHJRt2GDw7WDK0eX5GxVcL8fCjVE+ZaK9qH+ybiGt vh6dYpKuNNtuwmTOrqRlZZSE4zweMnOlBb3S7t5OEGWDeRddfEpYY6KiQsyDr/gsChTT dNmA== X-Gm-Message-State: APjAAAUWrGlz2LrOO+VqgYcOpt6d0pLBVh3DQrSaTm7+txBy7A0AMnEi miBgzA7dKUfmaOVgCW4nAeNxy7cRFuEHryUacXegfkS2 X-Google-Smtp-Source: APXvYqzKOe+wIYwONfdz2MWv7pMUjezbaaXgn1hEJ5ISFNRVkqe6x8Xn8UsHaNLOZVhwT7uTw573vLcutxl1702Kca4= X-Received: by 2002:ab0:902:: with SMTP id w2mr35813323uag.41.1577704669944; Mon, 30 Dec 2019 03:17:49 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::932 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:122115 Archived-At: Hello, I=E2=80=99m one of those heretics who dislike killing and yanking and insis= t on cutting and pasting instead. In other words, I use =E2=80=98cua-mode=E2= =80=99. For some time, I=E2=80=99ve been noticing that, occasionally, C-c does not work to copy the selected text to the clipboard. Instead, the minibuffer shows the =E2=80=98C-c-=E2=80=99 prompt, as if =E2=80=98cua-mode= =E2=80=99 were not active. Most often I notice that when using Magit buffers. Sometimes I was able to toggle =E2=80=98cua-mode=E2=80=99 off and on again and it fixed thi= ngs. Other times, it did not. I looked into the source of =E2=80=98cua-mode=E2=80=99 and found a possible= reason for that. The mechanism that =E2=80=98cua-mode=E2=80=99 uses to allow C-x and C-c to = be used for cutting and copying is described in cua-base.el under the heading =E2=80=98Prefix key override mechanism=E2=80=99. Essentially, it depends on= the =E2=80=98cua--prefix-override-keymap=E2=80=99 being active and pretty high = in the sequence of active keymaps. (In that map, C-c and C-x are bound to =E2=80=98cua--prefix-override-handler=E2=80=99, which allows =E2=80=98cua-m= ode=E2=80=99 to start a timer and do its thing when it expires.) The =E2=80=98cua--prefix-override-keymap=E2=80=99 is made active by means o= f the =E2=80=98emulation-mode-map-alists=E2=80=99 variable, which is second topmo= st source of active keymaps. Above it, there is the =E2=80=98keymap=E2=80=99 text pro= perty. So, if the current buffer text at point has a =E2=80=98keymap=E2=80=99 prop= erty, and that property specifies a keymap where C-x and/or C-c are prefix keys, then pressing C-x or C-c at that point will immediately go into prefix key handling, waiting for the next key in sequence. It so happens that Magit binds C-c C-e and C-c C-t in some of its maps that are applied to diff sections. So, when I want to copy something out of a diff section, I get the =E2=80=98C-c-=E2=80=99 prompt instead. Could =E2=80=98cua-mode=E2=80=99 do better, to also work when a keymap prop= erty binds C-c and/or C-x as prefix keys? Alternatively, does Magit (and all other modes that use the keymap property) need to do something special in order to not override =E2=80=98cua-mode=E2=80=99? Alternatively, am I on= my own here and do I have to unbind all C-c- bindings in any Magit keymaps I find? (Also, how would I go about removing those bindings?)