Previously we assumed the buffer was being displayed in a window
of the current frame, which isn't the case if e.g. a child frame
is being used.
We also cannot assume that the third-party code that sets up such
a child frame also deletes it. `which-key-posframe' for example
merely hides it.
With which-key-enable-extended-define-key set to 't, given the keymap
and bindings below:
(setq a-map (make-sparse-keymap))
(bind-keys :map a-map
("a" . ("key 1" . command-1))
("b" . ("key b" . command-2)))
The output of (which-key--get-keymap-bindings a-map) was having
"unknown" as the key descriptions.
This change fixes it therefore allows the following to work as
expected:
(which-key--show-keymap "A map" a-map)
Similarly to mode-line-format, header-line-format just takes up space and
currently also breaks window size calculations for the buffer. This sets
it to nil in order to suppress its display.
Signed-off-by: Frank Terbeck <ft@bewatermyfriend.org>
* Add test for #257
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
* Fix#257
Explicitly distinguish between replacing with `nil` and not replacing at
all.
I'm also simplifying the code by making all the branches more explicit.
This is a little longer, but makes all the clauses obvious.
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
The first optimization is avoiding the intermediate list created by
append. Instead we just iterate over the two lists in turn
The second opimitization occurs where
which-key-allow-multiple-replacements is nil, in which case we can stop
the iteration once we've found a replacement
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
As of:
7ac79872ae
make-text-button no longer modifies a string when it is passed as the
first argument. which-key--propertize-description relied on the mutation
of the string argument. Using the return value of make-text-button will
return the propertized string with both the new and old behavior.
Fixes#248
fit-window-to-buffer defaults to a min height of 4. For some reason, the order
in which fit-window-to-buffer is called in display-buffer-in-side-window seems
to have changed. This makes the order not matter.