2

ibuffer uses/ as a prefix key for filter commands, likeibuffer-filter-by-name (/n).

As an evil user, I wanted to use a different prefix, since evil uses/ for searching.

I usespace as a leader-key, so I decided to put the filter commands behindspace/.

The ibuffer/ prefix is an anonymous keymap, so I had to bind my new key to the result of alookup-key call:

(bind-map-for-mode-inherit ivan/ibuffer-leader-map ivan/leader-map  :major-modes (ibuffer-mode)  :bindings  ("/" (lookup-key ibuffer-mode-map "/")))  ; <= here

It works, but is there a cleaner way to do it?

I say it's an anonymous keymap because I wasn't able to find any variable bound to it. Running(lookup-key ibuffer-mode-map "/") just prints out the keymap body:

(keymap (92 . ibuffer-clear-filter-groups) ... (109 . ibuffer-filter-by-used-mode))
Drew's user avatar
Drew
80.9k10 gold badges125 silver badges265 bronze badges
askedFeb 19, 2017 at 18:06
ivan's user avatar

1 Answer1

2

It looks like the answer is yes, you are right. And there is no cleaner way to deal with it - but see below, for one suggestion.

I'd suggest filing an enhancement request that Emacs add a variable for this keymap:M-x report-emacs-bug.

You can of course define your own map variable for this, basing its value on the currentibuffer.el code. But that won't automatically pick up future changes to the Ibuffer code.

In general, I think it is a good idea for prefix keys to have associated keymap variables. That makes it easy for users to, e.g., move such a map to a different prefix key.

answeredFeb 19, 2017 at 18:18
Drew's user avatar
1
  • 1
    I liked your suggestion. I just filed an enhancement request.CommentedFeb 19, 2017 at 19:18

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.