From e9531795fb856cc4b1d0b7701d8f9bbd78da7db7 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 21 Jun 2024 21:53:20 +0200 Subject: [PATCH] (describe-mode-local-bindings[-in-mode]): Add 'minibuffer-action' --- lisp/mode-local.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/mode-local.el b/lisp/mode-local.el index 9f11b9707bd..a96b7df26ba 100644 --- a/lisp/mode-local.el +++ b/lisp/mode-local.el @@ -869,15 +869,22 @@ invoked interactively." (when (setq buffer (get-buffer buffer)) (mode-local-describe-bindings-1 buffer (called-interactively-p 'any)))) +(put 'describe-mode-local-bindings 'minibuffer-action "describe") + (defun describe-mode-local-bindings-in-mode (mode) "Display mode local bindings active in MODE hierarchy." (interactive - (list (completing-read - "Mode: " obarray - (lambda (s) (get s 'mode-local-symbol-table)) - t (symbol-name major-mode)))) + (list (let ((def (when (get major-mode 'mode-local-symbol-table) + major-mode))) + (completing-read + (format-prompt "Mode" def) obarray + (lambda (s) (get s 'mode-local-symbol-table)) + t nil nil def)))) (when (setq mode (intern-soft mode)) (mode-local-describe-bindings-1 mode (called-interactively-p 'any)))) + +(put 'describe-mode-local-bindings-in-mode 'minibuffer-action "describe") + (add-hook 'find-file-hook #'mode-local-post-major-mode-change) (add-hook 'change-major-mode-hook #'mode-local-on-major-mode-change) -- 2.39.2