bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Lars Ingebrigtsen
Subject: bug#25191: Redesign `recentf-menu-bar' logic and its callers
Date: Wed, 09 Oct 2019 09:46:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Alexander Shukaev <emacs@Alexander.Shukaev.name> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]