From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.devel,gmane.emacs.bugs Subject: 28.0.50; Move revert-buffer global binding into a prefix map Date: Thu, 04 Feb 2021 11:08:59 -0700 Message-ID: <87v9b73dtw.fsf@melete.silentflame.com> References: <87zh0mmr54.fsf@gmail.com> <87y2g5smya.fsf@gmail.com> <4FF55FBF-573D-4A70-B3FC-682CA25B7ECB@gnu.org> <83lfc53whk.fsf@gnu.org> <20210203180142.seu6o3i6u7jhkyrh@Ergus> <83eehx3to5.fsf@gnu.org> <20210203221628.xgvvxjvh56gyswba@Ergus> <20210204070033.pm4ido4hq7a6twif@Ergus> <83sg6brhyg.fsf@gnu.org> <87a6sjpyqs.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34659"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Gregory Heytings , Lars Ingebrigtsen , emacs-devel@gnu.org To: bug-gnu-emacs@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 04 19:49:27 2021 Return-path: Envelope-to: ged-emacs-devel@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 1l7jh0-0008oh-Hv for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Feb 2021 19:49:26 +0100 Original-Received: from localhost ([::1]:44630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7jgz-0008MP-IB for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Feb 2021 13:49:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7j3H-0001Cp-Dn; Thu, 04 Feb 2021 13:08:24 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:34141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7j36-0001T6-No; Thu, 04 Feb 2021 13:08:23 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4FDFF5C00BD; Thu, 4 Feb 2021 13:08:11 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 04 Feb 2021 13:08:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm2; bh=qLj651BZtbHAv2darrqAfZUrvp vHqGZpDzLIZ/vYsJM=; b=crNNf0bBY+PcWDRb4izDbiRyd0UnxJ+bNVKVmQWqlv rly4h0mRhzLpX4gt4cWpz1cNeCJ5OLaPRkJ+4hHqDgLBvuxbmLyQdVcpFPVKqGr7 Q8I+I3S/h0m09ozyPQBayb/EedZaNRaZSkRb/VNtel+kZXtKSscOYsweW5JTWNvx j9NOZfMQyj2KxWXoUjVLllWAwWnSNwzPNb5jR0e/rOpvD4kSm6+6TIhvNbZLG5oH OOtAZ8Z34U00Idi+sHJluOF695pMeTTPXPu+jQS3mS3yPQp5mPZycUWhLlg5Ib1a 2hxyzRLMjylE5Ly02axANX4vgtNQgwYCz66aEWMNfn5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=qLj651 BZtbHAv2darrqAfZUrvpvHqGZpDzLIZ/vYsJM=; b=bkrR8S/lGxs0G6IPSWikfP 2+yWB04H40cXdsmIAik3o+p7quR1wExJKYHzM5OBpyBPdQh6c8/jBWRJqllNqLoy UEdt2vL3VbZhF0gAP9eqwoyoE32tQefT8VxDiA43nwep3Bz0Q0MoEuNWGBgmhJ6s xm+ucUvCKFrZqKiJ8TqVum2ZKQZcH1XWMpFQbJyAqYW8LKtmLzP2nYJ+hQcwbFbW zcGNMS9OxzZLPNFZkoOpY3ETnL+JlkAG9pOFiG/E8D3K/mzeqHjhuLU0Qcvq1XZt JOYI1Te8TX1ntktmAeBnTo76q/Lkl/gREwrtdCb3GO5jSAVpZYTRHtJj6r4eYUGg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrgeeggddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhffkfggtgesmhdtreertddttdenucfhrhhomhepufgvrghnucgh hhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqeenuc ggtffrrghtthgvrhhnpeeifffhffduhfejgfefueeluedtvedtkedtheeigfeiteelveev keegudehtddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg X-ME-Proxy: In-Reply-To: <87a6sjpyqs.fsf@gnus.org> Received-SPF: pass client-ip=66.111.4.29; envelope-from=spwhitton@spwhitton.name; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:263893 gmane.emacs.bugs:199320 Archived-At: --=-=-= Content-Type: text/plain control: tag -1 + patch On Thu 04 Feb 2021 at 05:46PM +01, Lars Ingebrigtsen wrote: > Gregory Heytings writes: > >> You forgot the proposal to which the mail you are replying to >> explicitly refers. So I'll copy it here again: it is to make "C-x g" >> a keymap for buffer-related operations, with in particular "C-x g r" >> bound to revert-buffer: >> >> C-x g c = clone-buffer >> C-x g d = diff-buffers >> C-x g f = fit-frame-to-buffer >> C-x g h = hexl-mode >> C-x g i = insert-buffer >> C-x g l = font-lock-mode >> C-x g n = rename-buffer >> C-x g r = revert-buffer >> C-x g R = revert-buffer-with-fine-grain >> C-x g t = toggle-truncate-lines > > Of the alternative key bindings proposed, I like this the best. I'd > prefer `C-x g g' for revert-buffer, though -- it's more in like with the > `g' binding in `special-mode-map', and `revert-buffer' is a command > you're likely to want to execute a number of times (in some cases), > while the rest of these are less keyboard-mashey. Here's a patch doing that, since this seems like a solution which satisfies most. Exactly what else to bind into that map I leave to others, for now, anyway. -- Sean Whitton --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Move-revert-buffer-global-binding-to-C-x-g-g.patch >From ae48c8984724013a2b145fbac32c094dd54c8f0f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 4 Feb 2021 11:05:06 -0700 Subject: [PATCH] Move 'revert-buffer' global binding to 'C-x g g' * lisp/bindings.el: Define ctl-x-g-map and bind 'revert-buffer' to 'C-x g g' globally. * doc/emacs/files.texi: Replace 'C-x g' with 'C-x g g'. * etc/NEWS: Document the change. --- doc/emacs/files.texi | 2 +- etc/NEWS | 2 +- lisp/bindings.el | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 12ceac800e..dbdb9d582a 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -927,7 +927,7 @@ Manual}). For customizations, see the Custom group @code{time-stamp}. If you have made extensive changes to a file-visiting buffer and then change your mind, you can @dfn{revert} the changes and go back to -the saved version of the file. To do this, type @kbd{C-x g}. Since +the saved version of the file. To do this, type @kbd{C-x g g}. Since reverting unintentionally could lose a lot of work, Emacs asks for confirmation first. diff --git a/etc/NEWS b/etc/NEWS index dddc150af1..cf428621d2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -234,7 +234,7 @@ still applies for shorter search strings, which avoids flicker in the search buffer due to too many matches being highlighted. +++ -** 'revert-buffer' is now bound to 'C-x g' globally. +** 'revert-buffer' is now bound to 'C-x g g' globally. * Editing Changes in Emacs 28.1 diff --git a/lisp/bindings.el b/lisp/bindings.el index 9ea188d1a0..3ddaf0cec1 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1413,7 +1413,12 @@ if `inhibit-field-text-motion' is non-nil." (define-key ctl-x-map "z" 'repeat) -(define-key ctl-x-map "g" #'revert-buffer) +(defvar ctl-x-g-map + (let ((map (make-sparse-keymap))) + (define-key map "g" #'revert-buffer) + map) + "Keymap for subcommands of C-x g.") +(define-key ctl-x-map "g" ctl-x-g-map) (define-key esc-map "\C-l" 'reposition-window) -- 2.29.2 --=-=-=--