[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ergoemacs-mode 5692fc1 325/325: Add replacement for `C-
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ergoemacs-mode 5692fc1 325/325: Add replacement for `C-h k` |
Date: |
Sat, 23 Oct 2021 18:49:20 -0400 (EDT) |
branch: externals/ergoemacs-mode
commit 5692fc1f1e8d7f81706bf9d9df9ce371deb9486b
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Add replacement for `C-h k`
---
ergoemacs-theme-engine.el | 73 ++++++++++++++++++++++++++++++++++++++++++-----
ergoemacs-themes.el | 3 +-
2 files changed, 68 insertions(+), 8 deletions(-)
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index d02b65f..78accc0 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -266,8 +266,7 @@
(vr/query-replace "rep reg")
(write-file "save as")
(xref-pop-marker-stack "xref pop")
- (xref-find-definitions "xref find")
- )
+ (xref-find-definitions "xref find"))
"Ergoemacs short command names."
:group 'ergoemacs-themes
:type '(repeat :tag "Command abbreviation"
@@ -291,7 +290,7 @@
(defvar ergoemacs-theme--svg nil)
(defvar ergoemacs-theme--svg-prefixes nil)
(defvar ergoemacs-theme--svg-prefix nil)
-
+(defvar ergoemacs-current-emacs-command-emulation-list nil)
(defvar ergoemacs--emacs-command-emulation-list
'((kill-line ?\C-k)
(mark-whole-buffer ?\C-x ?h)
@@ -330,8 +329,11 @@
(mark-paragraph ?\M-\S-\ ))
"List of commands/keys that `ergoemacs-mode' replaces and send general emacs
keys.")
-(defvar ergoemacs--emacs-command-emulation-map nil
- "Keymap to describe the emacs-command-emulations")
+(defvar ergoemacs--emacs-command-emulation-map (make-sparse-keymap)
+ "Keymap to describe the emacs-command-emulations.")
+
+(defvar ergoemacs-override-alist--describe-bindings nil)
+(defvar ergoemacs-override--describe-bindings t)
(defun ergoemacs-describe-translations--now (buffer)
"Describe translations in BUFFER."
@@ -347,8 +349,7 @@
ergoemacs-mode-send-emacs-keys nil)
(unwind-protect
(dolist (elt ergoemacs--emacs-command-emulation-list)
- (let* (
- ;; Get the emacs key
+ (let* (;; Get the emacs key
(emacs-key (vconcat (cdr elt)))
;; Get Currently bound command
(emacs-command (key-binding emacs-key t t))
@@ -392,6 +393,64 @@ or a buffer name."
(insert "\n\n"))
(describe-buffer-bindings buffer prefix))))
+(defvar ergoemacs-command-loop--read-key-prompt)
+
+(defun ergoemacs-describe-key (&optional key-list buffer)
+ "Display documentation of the function invoked by KEY-LIST.
+KEY-LIST can be any kind of a key sequence; it can include keyboard events,
+mouse events, and/or menu events. When calling from a program,
+pass KEY-LIST as a list of elements (SEQ . RAW-SEQ) where SEQ is
+a key-sequence and RAW-SEQ is its untranslated form.
+
+While reading KEY-LIST interactively, this command temporarily enables
+menu items or tool-bar buttons that are disabled to allow getting help
+on them.
+
+BUFFER is the buffer in which to lookup those keys; it defaults to the
+current buffer."
+ (interactive
+ (progn
+ (setq ergoemacs-command-loop--read-key-prompt
+ "Describe the following Key, mouse-click, or menu item: ")
+ (unwind-protect
+ (list (help--read-key-sequence))
+ (setq ergoemacs-command-loop--read-key-prompt ""))))
+ (when (arrayp key-list)
+ ;; Compatibility with old calling convention.
+ (setq key-list (con
+ s (list key-list) (if up-event (list up-event))))
+ (when buffer
+ (let ((raw (if (numberp buffer) (this-single-command-raw-keys) buffer)))
+ (setf (cdar (last key-list)) raw)))
+ (setq buffer nil))
+ (when ergoemacs-mode-send-emacs-keys
+ (ergoemacs-describe-translations--now (or buffer (current-buffer))))
+ (remove-hook 'emulation-mode-map-alists ergoemacs-override-alist)
+ (setq ergoemacs-override-alist
+ `((ergoemacs-mode-send-emacs-keys .
,ergoemacs--emacs-command-emulation-map)
+ (ergeoemacs-mode-term-raw-mode . ,ergoemacs-mode-term-raw-keymap)
+ (ergoemacs--ena-prefix-override-keymap .
,ergoemacs--prefix-override-keymap)
+ (ergoemacs--ena-prefix-repeat-keymap .
,ergoemacs--prefix-repeat-keymap)
+ (ergoemacs--ena-region-keymap . ,ergoemacs-mark-active-keymap)
+ (ergoemacs-mode-regular . ,ergoemacs-user-keymap)
+ (ergoemacs-mode-regular . ,ergoemacs-override-keymap)
+ (ergoemacs-mode-regular . ,ergoemacs-keymap)
+ (ergoemacs-mode-send-emacs-keys . ,ergoemacs--send-emacs-keys-map)))
+ (add-hook 'emulation-mode-map-alists ergoemacs-override-alist)
+ (unwind-protect
+ (describe-key key-list buffer)
+ (remove-hook 'emulation-mode-map-alists ergoemacs-override-alist)
+ (setq ergoemacs-override-alist
+ `((ergeoemacs-mode-term-raw-mode . ,ergoemacs-mode-term-raw-keymap)
+ (ergoemacs--ena-prefix-override-keymap .
,ergoemacs--prefix-override-keymap)
+ (ergoemacs--ena-prefix-repeat-keymap .
,ergoemacs--prefix-repeat-keymap)
+ (ergoemacs--ena-region-keymap . ,ergoemacs-mark-active-keymap)
+ (ergoemacs-mode-regular . ,ergoemacs-user-keymap)
+ (ergoemacs-mode-regular . ,ergoemacs-override-keymap)
+ (ergoemacs-mode-regular . ,ergoemacs-keymap)
+ (ergoemacs-mode-send-emacs-keys .
,ergoemacs--send-emacs-keys-map)))
+ (add-hook 'emulation-mode-map-alists ergoemacs-override-alist)))
+
(defun ergoemacs-theme-describe ()
"Display the full documentation for Ergoemacs."
(interactive)
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index 76ebe0a..aef1ff9 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -656,7 +656,8 @@ These keys do not depend on the layout."
'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 describe-bindings] 'ergoemacs-describe-bindings))
+ (define-key keymap [remap describe-bindings] 'ergoemacs-describe-bindings)
+ (define-key keymap [remap describe-key] 'ergoemacs-describe-key))
(defun ergoemacs-set-menu-bar-file ()
"File menu."
- [elpa] externals/ergoemacs-mode d2d29aa 289/325: Another fix for mark-active indent region, (continued)
- [elpa] externals/ergoemacs-mode d2d29aa 289/325: Another fix for mark-active indent region, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 97623ad 286/325: Remove cua-mode again, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 87fe6ff 292/325: Remove shift C-c and C-x for now, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 2ae2ebf 294/325: Remove command loop, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 5689999 299/325: Fix CUA interference, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 9b72665 304/325: Use passthrough for kill-line, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 577997b 310/325: Pull in many more remaps for using Emacs keys, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 0d2d1c6 308/325: Change how sending emacs keys works, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode dc2e1a6 321/325: Bind ergoemacs-M-O for more generic fix, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode ea5a7f5 322/325: Remove compilation mode map (emulation overrides); Fix isearch M-O, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 5692fc1 325/325: Add replacement for `C-h k`,
Stefan Monnier <=
- [elpa] externals/ergoemacs-mode e718715 309/325: Add `mark-whole-buffer`, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 465d265 312/325: Merge branch 'passthrough', Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 500a2eb 314/325: Possibly Fix #505 search, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 8ea6d54 320/325: Some fixes for shift-select mode, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 6b1b60e 039/325: Cleanup, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode fdafbdf 049/325: Cleanup, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 2c3dbbf 098/325: Remove f1 binding and unused swiper(), Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 12a1552 259/325: Remove ergoemacs-timing, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 97ac03f 081/325: Resolve all of the :emacs keybindings in ergoemacs-themes, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 74ad06f 228/325: Remove deftheme, Stefan Monnier, 2021/10/23