branch: elpa/beancount commit 4750bfa4702253ec97c06f7ac0803c82210161a9 Author: Karl Fogel <kfo...@red-bean.com> Commit: Martin Blais <bl...@furius.ca>
Change keybindings to respect Emacs conventions Adjust the keybindings in `beancount-mode-map' (which is bound to C-c by default) to respect the Emacs keybinding conventions: namely, keep C-c LETTER reserved for user-defined bindings, and don't have a binding that ends in C-g, since users expect C-g to cancel a sequence. We accomplish this mostly by just changing all instances of C-c LETTER to C-c C-LETTER, with two exceptions: `beancount-transaction-clear' is moved from C-c C-g to C-c C-c, and `beancount-insert-prices' is moved from C-c p to C-c C-i (because C-c C-p is already recommended in README.org as the binding for `outline-previous-visible-heading', when one is using `outline-minor-mode', and we don't want to shadow that). Fixes #1. --- beancount.el | 18 +++++++++--------- etc/emacsrc | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/beancount.el b/beancount.el index 5344d004c1..d5a63c9d80 100644 --- a/beancount.el +++ b/beancount.el @@ -323,15 +323,15 @@ from the open directive for the relevant account." (define-key map (kbd "TAB") #'beancount-tab-dwim) (define-key map (kbd "M-RET") #'beancount-insert-date) (define-key map (vconcat p [(\')]) #'beancount-insert-account) - (define-key map (vconcat p [(control g)]) #'beancount-transaction-clear) - (define-key map (vconcat p [(l)]) #'beancount-check) - (define-key map (vconcat p [(q)]) #'beancount-query) - (define-key map (vconcat p [(x)]) #'beancount-context) - (define-key map (vconcat p [(k)]) #'beancount-linked) - (define-key map (vconcat p [(r)]) #'beancount-region-default) - (define-key map (vconcat p [(t)]) #'beancount-region-value) - (define-key map (vconcat p [(y)]) #'beancount-region-cost) - (define-key map (vconcat p [(p)]) #'beancount-insert-prices) + (define-key map (vconcat p [(control c)]) #'beancount-transaction-clear) + (define-key map (vconcat p [(control l)]) #'beancount-check) + (define-key map (vconcat p [(control q)]) #'beancount-query) + (define-key map (vconcat p [(control x)]) #'beancount-context) + (define-key map (vconcat p [(control k)]) #'beancount-linked) + (define-key map (vconcat p [(control r)]) #'beancount-region-default) + (define-key map (vconcat p [(control t)]) #'beancount-region-value) + (define-key map (vconcat p [(control y)]) #'beancount-region-cost) + (define-key map (vconcat p [(control i)]) #'beancount-insert-prices) (define-key map (vconcat p [(\;)]) #'beancount-align-to-previous-number) (define-key map (vconcat p [(\:)]) #'beancount-align-numbers) map)) diff --git a/etc/emacsrc b/etc/emacsrc index 7fc8bf450b..2dad11a418 100644 --- a/etc/emacsrc +++ b/etc/emacsrc @@ -46,6 +46,24 @@ (define-key* beancount-mode-map [(control c)(control p)] #'outline-previous-visible-heading) (define-key* beancount-mode-map [(control c)(control u)] #'outline-up-heading) +;; Restore old-style keybindings. +;; +;; If you prefer the old (pre-issue-#1) keybindings, you could +;; uncomment some or all of the lines below to selectively restore them. +;; Note that those old bindings don't respect Emacs conventions (see +;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html) +;; which is why they were changed in mid-2023. +;; +;; (define-key beancount-mode-map [(control c)(control g)] #'beancount-transaction-clear) +;; (define-key beancount-mode-map [(control c)(l)] #'beancount-check) +;; (define-key beancount-mode-map [(control c)(q)] #'beancount-query) +;; (define-key beancount-mode-map [(control c)(x)] #'beancount-context) +;; (define-key beancount-mode-map [(control c)(k)] #'beancount-linked) +;; (define-key beancount-mode-map [(control c)(r)] #'beancount-region-default) +;; (define-key beancount-mode-map [(control c)(t)] #'beancount-region-value) +;; (define-key beancount-mode-map [(control c)(y)] #'beancount-region-cost) +;; (define-key beancount-mode-map [(control c)(p)] #'beancount-insert-prices) + ;; Disable auto-indent. (defun disable-electric-indent ()