branch: externals/ivy-hydra
commit 63549dab8aff95d95acc8a5459e65e67edab1f99
Author: Basil L. Contovounesios <[email protected]>
Commit: Oleh Krehel <[email protected]>
Fix counsel-descbinds for Emacs 28
Parts of describe-buffer-bindings were recently rewritten in Elisp.
The new code seems to print page breaks and section headings to
standard-output instead of the current buffer.
* counsel.el (counsel--descbinds-cands): Bind standard-output to the
current buffer before calling describe-buffer-bindings. Simplify.
Fixes #2709.
---
counsel.el | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/counsel.el b/counsel.el
index 481231a..5000611 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1096,21 +1096,22 @@ See `describe-buffer-bindings' for further information."
"<vertical-scroll-bar>" "<horizontal-scroll-bar>")))
res)
(with-temp-buffer
- (let ((indent-tabs-mode t))
+ (let ((standard-output (current-buffer))
+ (indent-tabs-mode t))
(describe-buffer-bindings buffer prefix))
(goto-char (point-min))
;; Skip the "Key translations" section
- (re-search-forward "")
- (forward-char 1)
+ (skip-chars-forward "^\C-l")
+ (forward-char 2)
(while (not (eobp))
(when (looking-at "^\\([^\t\n]+\\)[\t ]*\\(.*\\)$")
(let ((key (match-string 1))
(fun (match-string 2))
cmd)
(unless (or (member fun '("??" "self-insert-command"))
- (string-match re-exclude key)
+ (string-match-p re-exclude key)
(not (or (commandp (setq cmd (intern-soft fun)))
- (member fun '("Prefix Command")))))
+ (equal fun "Prefix Command"))))
(push
(cons (format
"%-15s %s"
@@ -1118,7 +1119,7 @@ See `describe-buffer-bindings' for further information."
fun)
(cons key cmd))
res))))
- (forward-line 1)))
+ (forward-line)))
(nreverse res)))
(defcustom counsel-descbinds-function #'describe-function