From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Mon, 01 Aug 2022 18:09:07 +0000 Message-ID: References: <837d46mjen.fsf@gnu.org> <8a3eaeef01be5bfaa5ef@heytings.org> <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.org> <8c7321f2f3400a5db9be@heytings.org> <8c7321f2f388e5343475@heytings.org> <8c7321f2f36494299e61@heytings.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="XdeDKiDfOI" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29492"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Eli Zaretskii To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 01 20:10:24 2022 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 1oIZs0-0007WO-8z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Aug 2022 20:10:24 +0200 Original-Received: from localhost ([::1]:37560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIZry-0003LA-LF for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Aug 2022 14:10:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIZre-0003Kd-Pw for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2022 14:10:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIZre-0007dd-Fg for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2022 14:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIZre-0008BT-3D for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2022 14:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Aug 2022 18:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.165937735331385 (code B ref 56682); Mon, 01 Aug 2022 18:10:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 1 Aug 2022 18:09:13 +0000 Original-Received: from localhost ([127.0.0.1]:41597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIZqq-0008A9-Tt for submit@debbugs.gnu.org; Mon, 01 Aug 2022 14:09:13 -0400 Original-Received: from heytings.org ([95.142.160.155]:34318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIZqm-00089w-Pg for 56682@debbugs.gnu.org; Mon, 01 Aug 2022 14:09:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659377348; bh=f5dDCF6NqRFDumZ2oolfFXW4ziSZdjKG0PJPMaQ7TfE=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=pz2phzqb2zrF2yuzvI1pIKPr3Hvvv2lRnm9cVVKgtTbKk65I1VsmnUTgyiBoQ8oDi p79vI7ptZt3cRrm0shPZAqQVcefJHRAoAjO2NDdTGyNgJtjk/OR3TUk43Xf0BJSFNu wGrPnKuJ0N1g4PF2V+Cht/nV9Fp9+rqNZs/paL2A8vMIQROd+yAJDXUTJ+pmepmVdY +ly+kA6Lc9syQaGxBMEHX229UNqD26RwVcuR1YcCiKLuEHo4Jry4BH5pkK01jJlbg1 6HgdguTKaWS5cC9B8I8tg98snu324SM2ckf4ctefd/vZUUnXstTRdbqYSCbJvINZOk wycN6kk2l4Hjg== In-Reply-To: Content-ID: 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:238457 Archived-At: --XdeDKiDfOI Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-ID: >>> Try `M-: (use-global-map (make-keymap)) RET` >>> >>> Should we prevent users from doing that? >> >> It's a misleading question. No "user" would ever do that. Sure, it's= =20 >> a nice example, but only an Elisp hacker would do that, in the middle=20 >> of a debugging session, and they would do that on purpose (although=20 >> perhaps without knowing the effect in advance). Which has nothing to=20 >> do with a regular user who just opens a file. > > FWIW, the above is my standard example because I ended up doing exactly= =20 > that by accident, locking myself out of the session I was trying to=20 > debug, so in a sense, I'd have been happy (that one time) if Emacs had=20 > prevented me from doing it. > So... what do you think of the following? =F0=9F=98=89 diff --git a/src/keymap.c b/src/keymap.c index 506b755e5d..e42bc64717 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1881,6 +1881,17 @@ DEFUN ("use-global-map", Fuse_global_map,=20 Suse_global_map, 1, 1, 0, (Lisp_Object keymap) { keymap =3D get_keymap (keymap, 1, 1); + + /* Prevent locking Emacs if someone inadvertently evaluates + (use-global-map (make-keymap)) */ + if (EQ (Fequal (keymap, Fmake_keymap (Qnil)), Qt)) + { + Lisp_Object meta_colon_key =3D CALLN (Fvector, make_fixnum (13421778= 6)); + Lisp_Object default_key =3D CALLN (Fvector, Qt); + Fdefine_key (keymap, meta_colon_key, intern ("eval-expression"), Qni= l); + Fdefine_key (keymap, default_key, intern ("self-insert-command"), Qn= il); + } + current_global_map =3D keymap; return Qnil; --XdeDKiDfOI--