GNU bug report logs -
#77324
31.0.50; bind-chord uses internal representation of key-chord instead of key-chord-define
Previous Next
Full log
View this message in rfc822 format
StrawberryTea <look <at> strawberrytea.xyz> writes:
Oh wait, regarding the last bug I submitted about bind-chord, I have
realized that bind-chord is being maintained separately on GitHub and is
not included in the use-package Emacs is maintaining. So I have
submitted my code change there
https://github.com/jwiegley/use-package/pull/1088
Sincerely,
StrawberryTea/LemonBreezes
> Let me know if I sent this patch correctly. But basically, I am making a
> major update to key-chord and need bind-chord to use key-chord-define
> instead of hacking the internal representation of a key-chord.
> https://github.com/emacsorphanage/key-chord/pull/12
>
> Sincerely,
> StrawberryTea/LemonBreezes
>
> From 2ea21cd51de9c6c771787d06e4b3eb90e01b65e8 Mon Sep 17 00:00:00 2001
> From: StrawberryTea <look <at> strawberrytea.xyz>
> Date: Thu, 27 Mar 2025 19:56:13 -0400
> Subject: [PATCH] fix: Update bind-chord to use key-chord-define
>
> ---
> bind-chord.el | 16 ++++++++++------
> use-package-chords.el | 4 ++--
> 2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/bind-chord.el b/bind-chord.el
> index ed736a4..af1dcc8 100644
> --- a/bind-chord.el
> +++ b/bind-chord.el
> @@ -5,7 +5,7 @@
> ;; Author: Justin Talbott <justin <at> waymondo.com>
> ;; Keywords: convenience, tools, extensions
> ;; URL: https://github.com/jwiegley/use-package-;; Version: 0.2.1
> +;; Version: 0.2.2
> ;; Package-Requires: ((emacs "24.3") (bind-key "1.0") (key-chord "0.6"))
> ;; Filename: bind-chord.el
>
> @@ -28,17 +28,21 @@
>
> (require 'bind-key)
> (require 'key-chord nil t)
> +(declare-function key-chord-define "key-chord" (keymap keys command))
>
> ;;;###autoload
> (defmacro bind-chord (chord command &optional keymap)
> "Bind CHORD to COMMAND in KEYMAP (`global-map' if not passed)."
> (let ((key1 (logand 255 (aref chord 0)))
> (key2 (logand 255 (aref chord 1))))
> - (if (eq key1 key2)
> - `(bind-key (vector 'key-chord ,key1 ,key2) ,command ,keymap)
> - `(progn
> - (bind-key (vector 'key-chord ,key1 ,key2) ,command ,keymap)
> - (bind-key (vector 'key-chord ,key2 ,key1) ,command ,keymap)))))
> + `(progn
> + ;; Use key-chord's built-in define function to properly register keys
> + (key-chord-define ,(if keymap keymap 'global-map)
> + ,(cond
> + ((stringp chord) chord)
> + ((vectorp chord) chord)
> + (t `(string ,key1 ,key2)))
> + ,command))))
>
> (defun bind-chords-form (args keymap)
> "Bind multiple chords at once.
> diff --git a/use-package-chords.el b/use-package-chords.el
> index 479083b..a5b0393 100644
> --- a/use-package-chords.el
> +++ b/use-package-chords.el
> @@ -5,8 +5,8 @@
> ;; Author: Justin Talbott <justin <at> waymondo.com>
> ;; Keywords: convenience, tools, extensions
> ;; URL: https://github.com/jwiegley/use-package-;; Version: 0.2.1
> -;; Package-Requires: ((use-package "2.1") (bind-key "1.0") (bind-chord "0.2") (key-chord "0.6"))
> +;; Version: 0.2.2
> +;; Package-Requires: ((use-package "2.1") (bind-key "1.0") (bind-chord "0.2.2") (key-chord "0.6"))
> ;; Filename: use-package-chords.el
>
> ;; This program is free software; you can redistribute it and/or modify
This bug report was last modified 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.