** Help
+---
+*** Commands like 'C-h f' have changed how they describe menu bindings.
+For instance, previously a command might be described as having the
+following bindings:
+
+ It is bound to <open>, C-x C-f, <menu-bar> <file> <new-file>.
+
+This has been changed to:
+
+ It is bound to <open> and C-x C-f.
+ It can also be invoked from the menu: File → Visit New File....
+
+++
*** The 'C-h .' command now accepts a prefix argument.
'C-u C-h .' would previously inhibit displaying a warning message if
(insert (concat "It can "
(and keys "also ")
"be invoked from the menu: "))
- ;; FIXME: Should insert menu names instead of key
- ;; binding names.
- (help-fns--insert-bindings menus)
+ (help-fns--insert-menu-bindings menus)
(insert ".")
(fill-region-as-paragraph start (point))))
(ensure-empty-lines)))))))
(insert (help--key-description-fontified key)))
keys))
+(defun help-fns--insert-menu-bindings (menus)
+ (seq-do-indexed
+ (lambda (menu i)
+ (insert
+ (cond ((zerop i) "")
+ ((= i (1- (length menus))) " and ")
+ (t ", ")))
+ (let ((map (lookup-key global-map (seq-take menu 1)))
+ (start (point)))
+ (seq-do-indexed
+ (lambda (entry level)
+ (when (> level 0)
+ (insert
+ (if (char-displayable-p ?→)
+ " → "
+ " => ")))
+ (let ((elem (assq entry (cdr map))))
+ (if (eq (nth 1 elem) 'menu-item)
+ (progn
+ (insert (nth 2 elem))
+ (setq map (cadddr elem)))
+ (insert (nth 1 elem))
+ (setq map (cddr elem)))))
+ (cdr (seq-into menu 'list)))
+ (put-text-property start (point) 'face 'help-key-binding)))
+ menus))
+
(defun help-fns--compiler-macro (function)
(let ((handler (function-get function 'compiler-macro)))
(when handler