summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2022-06-04 18:15:10 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2022-06-04 18:56:58 +0200
commit450cf9d9e77906a986f82d6f1d409b5fc66e9175 (patch)
treec5433958223eecc748c284470b883b31ab613963
parent175835dc0c147887431c6f4a851a3e7fd32bab47 (diff)
Remove content-handler
It is better to instead run (with-current-buffer " *corfu-doc*" (visual-line-mode 1)) after frame creation. Also instead of calling visual-line-mode it may make more sense to instead set the variables directly. The mode doesn't do much more than setting a bunch of variables.
-rw-r--r--corfu.el13
1 files changed, 5 insertions, 8 deletions
diff --git a/corfu.el b/corfu.el
index 978b901..734d33d 100644
--- a/corfu.el
+++ b/corfu.el
@@ -369,7 +369,7 @@ The completion backend can override this with
map)
"Ignore all mouse clicks.")
-(defun corfu--make-buffer (content buffer-name &optional content-handler)
+(defun corfu--make-buffer (content buffer-name)
"Create buffer with CONTENT and a specified BUFFER-NAME.
CONTENT-HANDLER is a function called with the inserted buffer content."
@@ -388,12 +388,10 @@ CONTENT-HANDLER is a function called with the inserted buffer content."
(inhibit-read-only t))
(erase-buffer)
(insert content)
- (when content-handler (funcall content-handler))
(goto-char (point-min))))
buffer))
-(defun corfu--make-frame-1 (content buffer-name frame frame-params
- &optional content-handler)
+(defun corfu--make-frame-1 (content buffer-name frame frame-params)
"Make child frame with CONTENT.
The BUFFER-NAME and CONTENT-HANDLER parameters are the same as
@@ -404,7 +402,7 @@ The extra frame parameters can be specified with FRMAE-PARAMS.
The created frame can be accessed via FRAME."
(let* ((after-make-frame-functions)
(border (alist-get 'child-frame-border-width frame-params))
- (buffer (corfu--make-buffer content buffer-name content-handler))
+ (buffer (corfu--make-buffer content buffer-name))
(parent (window-frame)))
(unless (and (frame-live-p frame)
(eq (frame-parent frame) parent))
@@ -469,8 +467,7 @@ The created frame can be accessed via FRAME."
;; Function adapted from posframe.el by tumashu
(defun corfu--make-frame (x y width height content
- buffer-name frame frame-params
- &optional content-handler)
+ buffer-name frame frame-params)
"Show child frame at X/Y with WIDTH/HEIGHT and CONTENT.
The rest of the parameters are the same as the corresponding parameters
@@ -478,7 +475,7 @@ in `corfu--make-frame-1'."
(let ((parent (window-frame))
(frame
(corfu--make-frame-1
- content buffer-name frame frame-params content-handler)))
+ content buffer-name frame frame-params)))
(corfu--set-frame-position frame x y width height 'hack-redisplay)
(redirect-frame-focus frame parent)
frame))