diff options
| -rw-r--r-- | corfu.el | 11 | ||||
| -rw-r--r-- | extensions/corfu-popupinfo.el | 29 |
2 files changed, 19 insertions, 21 deletions
@@ -437,8 +437,8 @@ length override, set to t for manual completion." 'resize-mode))) ;; Function adapted from posframe.el by tumashu -(defun corfu--make-frame (frame x y width height buffer) - "Show BUFFER in child frame at X/Y with WIDTH/HEIGHT. +(defun corfu--make-frame (frame x y width height) + "Show current buffer in child frame at X/Y with WIDTH/HEIGHT. FRAME is the existing frame." (when-let (((frame-live-p frame)) (timer (frame-parameter frame 'corfu--hide-timer))) @@ -488,8 +488,8 @@ FRAME is the existing frame." unless (equal (alist-get k is) v) collect p))) (when diff (modify-frame-parameters frame diff))) (let ((win (frame-root-window frame))) - (unless (eq (window-buffer win) buffer) - (set-window-buffer win buffer)) + (unless (eq (window-buffer win) (current-buffer)) + (set-window-buffer win (current-buffer))) ;; Disallow selection of root window (gh:minad/corfu#63) (set-window-parameter win 'no-delete-other-windows t) (set-window-parameter win 'no-other-window t) @@ -1058,8 +1058,7 @@ A scroll bar is displayed from LO to LO+BAR." str)) lines "\n")) (goto-char (point-min))) - (setq corfu--frame (corfu--make-frame corfu--frame x y - width height (current-buffer))))))) + (setq corfu--frame (corfu--make-frame corfu--frame x y width height)))))) (cl-defgeneric corfu--popup-hide () "Hide Corfu popup." diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el index b74da2a..1115afb 100644 --- a/extensions/corfu-popupinfo.el +++ b/extensions/corfu-popupinfo.el @@ -376,21 +376,20 @@ form (X Y WIDTH HEIGHT DIR)." (- (frame-pixel-width corfu-popupinfo--frame) border border) (- (frame-pixel-height corfu-popupinfo--frame) border border))))) (margin-quirk (not corfu-popupinfo--frame))) - (setq corfu-popupinfo--frame - (corfu--make-frame corfu-popupinfo--frame - area-x area-y area-w area-h - corfu-popupinfo--buffer) - corfu-popupinfo--toggle t - corfu-popupinfo--lock-dir area-d - corfu-popupinfo--candidate candidate - corfu-popupinfo--coordinates new-coords) - ;; XXX HACK: Force margin update. For some reason, the call to - ;; `set-window-buffer' in `corfu--make-frame' is not effective the - ;; first time. Why does Emacs have all these quirks? - (when margin-quirk - (set-window-buffer - (frame-root-window corfu-popupinfo--frame) - corfu-popupinfo--buffer))))))) + (with-current-buffer corfu-popupinfo--buffer + (setq corfu-popupinfo--frame + (corfu--make-frame corfu-popupinfo--frame + area-x area-y area-w area-h) + corfu-popupinfo--toggle t + corfu-popupinfo--lock-dir area-d + corfu-popupinfo--candidate candidate + corfu-popupinfo--coordinates new-coords) + ;; XXX HACK: Force margin update. For some reason, the call to + ;; `set-window-buffer' in `corfu--make-frame' is not effective the + ;; first time. Why does Emacs have all these quirks? + (when margin-quirk + (set-window-buffer (frame-root-window corfu-popupinfo--frame) + corfu-popupinfo--buffer)))))))) (defun corfu-popupinfo--hide () "Clear the info popup buffer content and hide it." |
