From: Eshel Yaron Date: Fri, 21 Jun 2024 19:53:20 +0000 (+0200) Subject: (describe-mode-local-bindings[-in-mode]): Add 'minibuffer-action' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e9531795fb856cc4b1d0b7701d8f9bbd78da7db7;p=emacs.git (describe-mode-local-bindings[-in-mode]): Add 'minibuffer-action' --- 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)