diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2025-12-13 20:53:06 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2025-12-13 20:59:30 +0100 |
| commit | 4c4a41b0b3a7a65729b701670052d2287f57b427 (patch) | |
| tree | cff31616df1a9d496e5b72e09b62c0b43b148091 | |
| parent | d73949b3e1ccada479acea91a11ede393a230166 (diff) | |
Work around Emacs bug#79792
| -rw-r--r-- | CHANGELOG.org | 1 | ||||
| -rw-r--r-- | extensions/corfu-info.el | 11 | ||||
| -rw-r--r-- | extensions/corfu-popupinfo.el | 16 |
3 files changed, 17 insertions, 11 deletions
diff --git a/CHANGELOG.org b/CHANGELOG.org index 0d10038..6924b47 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -6,6 +6,7 @@ - corfu-popupinfo: Faster scrolling speed. - corfu-popupinfo: Fix Emacs 30 deprecation warning. +- Work around Emacs bug#79792, where the ~*Help*~ buffer is replaced unexpectedly. - Experimental: Use new function =set-frame-size-and-position-pixelwise= if available. The patch can be downloaded from here: https://lists.gnu.org/archive/html/emacs-devel/2025-12/msg00359.html diff --git a/extensions/corfu-info.el b/extensions/corfu-info.el index 6298db7..4ce4b62 100644 --- a/extensions/corfu-info.el +++ b/extensions/corfu-info.el @@ -35,7 +35,8 @@ (require 'corfu) (eval-when-compile - (require 'subr-x)) + (require 'subr-x) + (require 'cl-lib)) (defun corfu-info--restore-on-next-command () "Restore window configuration before next command." @@ -73,13 +74,15 @@ If called with a prefix ARG, the buffer is persistent." ;; Company support, taken from `company.el', see `company-show-doc-buffer'. (when (< corfu--index 0) (user-error "No candidate selected")) - (let* ((cand (nth corfu--index corfu--candidates)) - (cand-str (substring-no-properties cand))) + (cl-letf* ((cand (nth corfu--index corfu--candidates)) + (cand-str (substring-no-properties cand)) + ((symbol-function #'help-buffer) ;; Work around bug#79792 + (lambda () (get-buffer-create " *corfu-info*")))) (if-let ((fun (corfu--metadata-get 'company-doc-buffer)) (res (funcall fun cand))) (set-window-start (corfu-info--display-buffer (get-buffer (or (car-safe res) res)) - (and arg (format "*corfu doc: %s*" cand-str))) + (and arg (format "*corfu info: %s*" cand-str))) (or (cdr-safe res) (point-min))) (user-error "No documentation available for `%s'" cand-str)))) diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el index 3451030..dcd678e 100644 --- a/extensions/corfu-popupinfo.el +++ b/extensions/corfu-popupinfo.el @@ -223,13 +223,15 @@ all values are in pixels relative to the origin. See "Get the documentation for CANDIDATE." (when-let ((fun (corfu--metadata-get 'company-doc-buffer)) (res (save-excursion - (let ((inhibit-message t) - (message-log-max nil) - (inhibit-redisplay t) - ;; Reduce print length for elisp backend (#249) - (print-level 3) - (print-length (* corfu-popupinfo-max-width - corfu-popupinfo-max-height))) + (cl-letf (((symbol-function #'help-buffer) ;; Work around bug#79792 + (lambda () (get-buffer-create " *corfu-info*"))) + (inhibit-message t) + (message-log-max nil) + (inhibit-redisplay t) + ;; Reduce print length for elisp backend (#249) + (print-level 3) + (print-length (* corfu-popupinfo-max-width + corfu-popupinfo-max-height))) (funcall fun candidate))))) (with-current-buffer (or (car-safe res) res) (setq res (string-trim |
