[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ergoemacs-mode 9b74f23 323/325: Fix describe bindings t
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ergoemacs-mode 9b74f23 323/325: Fix describe bindings to show ergoemacs pass-through keys. |
Date: |
Sat, 23 Oct 2021 18:49:20 -0400 (EDT) |
branch: externals/ergoemacs-mode
commit 9b74f2366038c1142072e92fabe233201cafc2f7
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Fix describe bindings to show ergoemacs pass-through keys.
---
ergoemacs-theme-engine.el | 86 ++++++++++++++++++++++++++++++++---------------
ergoemacs-themes.el | 5 ++-
2 files changed, 61 insertions(+), 30 deletions(-)
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 336c653..90a899a 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -333,6 +333,64 @@
(defvar ergoemacs--emacs-command-emulation-map nil
"Keymap to describe the emacs-command-emulations")
+(defun ergoemacs-describe-translations--now ()
+ "Describe translations in current buffer."
+ (setq ergoemacs--emacs-command-emulation-map (make-sparse-keymap))
+ (when ergoemacs-mode-send-emacs-keys
+ ;; Turn of ergoemacs-mode keys for tranlsation
+ (setq ergoemacs-mode-regular nil
+ ergeoemacs-mode-term-raw-mode nil
+ ergoemacs--ena-prefix-override-keymap nil
+ ergoemacs--ena-prefix-repeat-keymap nil
+ ergoemacs--ena-region-keymap nil
+ ergoemacs-mode-send-emacs-keys nil)
+ (unwind-protect
+ (dolist (elt ergoemacs--emacs-command-emulation-list)
+ (let* (
+ ;; Get the emacs key
+ (emacs-key (vconcat (cdr elt)))
+ ;; Get Currently bound command
+ (emacs-command (key-binding emacs-key t t))
+ ;; Get the ergoemacs-mode keys
+ (command (car elt))
+ (keys (where-is-internal command ergoemacs-override-keymap
nil t t))
+ first-elt)
+ (when keys
+ (dolist (k keys)
+ (setq first-elt (aref k 0))
+ (unless (and (numberp first-elt) (= first-elt 27))
+ (define-key ergoemacs--emacs-command-emulation-map k
emacs-command))))))
+ (setq ergoemacs-mode-regular t
+ ergeoemacs-mode-term-raw-mode nil
+ ergoemacs--ena-prefix-override-keymap nil
+ ergoemacs--ena-prefix-repeat-keymap nil
+ ergoemacs--ena-region-keymap nil
+ ergoemacs-mode-send-emacs-keys t))
+ (substitute-command-keys "\\{ergoemacs--emacs-command-emulation-map}")))
+
+(defun ergoemacs-describe-bindings (&optional prefix buffer)
+ "Display a buffer showing a list of all defined keys, and their definitions.
+The keys are displayed in order of precedence.
+
+The optional argument PREFIX, if non-nil, should be a key sequence;
+then we display only bindings that start with that prefix.
+The optional argument BUFFER specifies which buffer's bindings
+to display (default, the current buffer). BUFFER can be a buffer
+or a buffer name."
+ (interactive)
+ (or buffer (setq buffer (current-buffer)))
+ (help-setup-xref (list #'describe-bindings prefix buffer)
+ (called-interactively-p 'interactive))
+ (with-help-window (help-buffer)
+ ;; Be aware that `describe-buffer-bindings' puts its output into
+ ;; the current buffer.
+ (with-current-buffer (help-buffer)
+ (when ergoemacs-mode-send-emacs-keys
+ (insert "Ergoemacs-mode translation in this buffer\n")
+ (insert (ergoemacs-describe-translations--now))
+ (insert "\n\n"))
+ (describe-buffer-bindings buffer prefix))))
+
(defun ergoemacs-theme-describe ()
"Display the full documentation for Ergoemacs."
(interactive)
@@ -393,33 +451,7 @@
(help-xref-button 1 'help-url (replace-regexp-in-string
"[.]svg\\'" ".png" (nth 2 elt)))))
(insert "\n\n"))))
(insert "\n\n")
- (setq required-p t)
- (when ergoemacs-mode-send-emacs-keys
- (setq ergoemacs--emacs-command-emulation-map (make-sparse-keymap))
- (dolist (elt ergoemacs--emacs-command-emulation-list)
- (let* (; Turn of ergoemacs-mode keys for tranlsation
- (ergoemacs-mode-regular nil)
- (ergeoemacs-mode-term-raw-mode nil)
- (ergoemacs--ena-prefix-override-keymap nil)
- (ergoemacs--ena-prefix-repeat-keymap nil)
- (ergoemacs--ena-region-keymap nil)
- (ergoemacs-mode-send-emacs-keys nil)
- ;; Get the emacs key
- (emacs-key (vconcat (cdr elt)))
- ;; Get Currently bound command
- (emacs-command (with-current-buffer cb (key-binding
emacs-key t t)))
- ;; Get the ergoemacs-mode keys
- (command (car elt))
- (keys (where-is-internal command ergoemacs-override-keymap
nil t t))
- first-elt)
- (when keys
- (dolist (k keys)
- (setq first-elt (aref k 0))
- (unless (and (numberp first-elt) (= first-elt 27))
- (message "do")
- (define-key ergoemacs--emacs-command-emulation-map k
command))))))
- (insert "Commands that ergoemacs keys run in current buffer\n\n")
- (insert (substitute-command-keys
"\\{ergoemacs--emacs-command-emulation-map}")))
+
(buffer-string)))))
(defun ergoemacs-theme--svg-elt-nonabbrev (what)
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index c567446..76ebe0a 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -655,7 +655,8 @@ These keys do not depend on the layout."
(define-key keymap [remap describe-mode]
'ergoemacs-describe-major-mode)
(define-key keymap [remap cua-paste] 'ergoemacs-paste)
- (define-key keymap [remap cua-cut-region] 'ergoemacs-cut-line-or-region))
+ (define-key keymap [remap cua-cut-region] 'ergoemacs-cut-line-or-region)
+ (define-key keymap [remap describe-bindings] 'ergoemacs-describe-bindings))
(defun ergoemacs-set-menu-bar-file ()
"File menu."
@@ -1320,8 +1321,6 @@ In a terminal, this can be either arrow keys (e.g. meta+O
A == <up>) or regular
(ergoemacs-unset-keys ergoemacs-override-keymap)
(ergoemacs-set-standard-vars)
-
-
(ergoemacs-set-standard-fixed ergoemacs-override-keymap)
(dolist (map (list ergoemacs-override-keymap ergoemacs-mode-term-raw-keymap))
(ergoemacs-set-move-char map)
- [elpa] externals/ergoemacs-mode 3f961db 302/325: Fix parens, (continued)
- [elpa] externals/ergoemacs-mode 3f961db 302/325: Fix parens, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 6f93579 301/325: Use meta for term mode types items, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode b0a5d10 305/325: Remove R history, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode f5a7c78 306/325: Update command for calculate-bindings, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 0e2f769 311/325: Merge pull request #507 from ergoemacs/describe_theme, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 0a96bf9 313/325: Add theme, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 8747314 317/325: Merge pull request #509 from Esgariot/fix/undo-fu-redo, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode c4f81d2 318/325: Fix for isearch-mode-map backward was missing, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode de96ab4 316/325: fix: undo-fu redo., Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode d7cd76b 319/325: Merge remote-tracking branch 'origin/master', Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 9b74f23 323/325: Fix describe bindings to show ergoemacs pass-through keys.,
Stefan Monnier <=
- [elpa] externals/ergoemacs-mode 0aaa14e 324/325: Make sure that key-binding works on current buffer., Stefan Monnier, 2021/10/23