Subject: bug#25191: Redesign `recentf-menu-bar' logic and its callers

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 09 Oct 2019 09:46:16 +0200

Alexander Shukaev <[email-masked]> writes:

> (defsubst recentf-menu-bar ()
>   "Return the keymap of the global menu bar."
>   (lookup-key global-map [menu-bar]))
>
> (defun recentf-show-menu ()
>   "Show the menu of recently opened files."
>   (easy-menu-add-item
>    (recentf-menu-bar) recentf-menu-path
>    (list recentf-menu-title :filter 'recentf-make-menu-items)
>    recentf-menu-before))
>
> (defun recentf-hide-menu ()
>   "Hide the menu of recently opened files."
>   (easy-menu-remove-item (recentf-menu-bar) recentf-menu-path
>                          recentf-menu-title))
>
> from 'recentf.el'.  This code is ill-formed.  When `global-map' is
> customized in such a way that it does not have `(kbd "<menu-bar>")'
> (or `[menu-bar]'), then both `recentf-show-menu' and
> `recentf-hide-menu' will fail.

I've now added checks to protect against this in Emacs 27.

> Furthermore, according to Emacs documentation, using
> `(current-global-map)' is more correct than `global-map'.

That's true, but I think fixing that is more a matter of somebody
grepping and replacing rather than fixing piecemeal, perhaps...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no