Note: this file is auto converted from posframe.el by el2org, please do not edit it by hand!!!
Posframe can pop a posframe at point, this posframe is a child-frame with its root window's buffer.
The main advantages are:
- It is fast enough for daily usage :-)
- It works well with CJK language.
NOTE: For MacOS users, posframe need Emacs (version >= 26.0.91)
(require 'posframe)
-
Simple way
(when (posframe-workable-p) (posframe-show " *my-posframe-buffer*" :string "This is a test" :position (point)))
-
Advanced way
(defvar my-posframe-buffer " *my-posframe-buffer*") (with-current-buffer (get-buffer-create my-posframe-buffer) (erase-buffer) (insert "Hello world")) (when (posframe-workable-p) (posframe-show my-posframe-buffer :position (point)))
-
Arguments
C-h f posframe-show
(posframe-hide " *my-posframe-buffer*")
M-x posframe-hide-all
-
Delete posframe and its buffer
(posframe-delete " *my-posframe-buffer*")
-
Only delete posframe's frame
(posframe-delete-frame " *my-posframe-buffer*")
M-x posframe-delete-all
Note: this command will delete all posframe buffers, suggest not run this command if you are sharing a buffer between posframe and other packages.
By default, posframe moves the pointer to point (0,0) in the frame, as a way to address an issue with mouse focus. To disable this feature, add this to your init.el:
(setq posframe-mouse-banish nil)
user can set fallback values of posframe-show's arguments with the help of `posframe-arghandler'. the below example set fallback border-width to 10 and fallback background color to green.
(setq posframe-arghandler #'my-posframe-arghandler)
(defun my-posframe-arghandler (posframe-buffer arg-name value)
(let ((info '(:internal-border-width 10 :background-color "green")))
(or (plist-get info arg-name) value)))