Skip to content
forked from tumashu/posframe

Pop a posframe (just a child-frame) at point

Notifications You must be signed in to change notification settings

conao3/posframe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Note: this file is auto converted from posframe.el by el2org, please do not edit it by hand!!!

目录

  1. Posframe README
    1. What is posframe?
    2. Installation
    3. Usage
      1. Create a posframe
      2. Hide a posframe
      3. Hide all posframes
      4. Delete a posframe
      5. Delete all posframes
      6. Customizing mouse pointer control
      7. Set fallback arguments of posframe-show

Posframe README

What is posframe?

Posframe can pop up a frame at point, this posframe is a child-frame connected to its root window's buffer.

The main advantages are:

  1. It is fast enough for daily usage :-)
  2. It works well with CJK languages.

NOTE: For MacOS users, posframe needs Emacs version >= 26.0.91

img

Installation

(require 'posframe)

Usage

Create a posframe

  1. Simple way

    (when (posframe-workable-p)
      (posframe-show " *my-posframe-buffer*"
                     :string "This is a test"
                     :position (point)))
    
  2. 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)))
    
  3. Arguments

    C-h f posframe-show
    

Hide a posframe

(posframe-hide " *my-posframe-buffer*")

Hide all posframes

M-x posframe-hide-all

Delete a posframe

  1. Delete posframe and its buffer

    (posframe-delete " *my-posframe-buffer*")
    
  2. Only delete the frame

    (posframe-delete-frame " *my-posframe-buffer*")
    

Delete all posframes

M-x posframe-delete-all

Note: this command will delete all posframe buffers. You probably shouldn't use it if you are sharing a buffer between posframe and other packages.

Customizing mouse pointer control

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)

Set fallback arguments of posframe-show

Users can set fallback values of posframe-show's arguments with the help of `posframe-arghandler'. The example below sets fallback border-width to 10 and fallback background color to green.

(setq posframe-arghandler #'my-posframe-arghandler)
(defun my-posframe-arghandler (buffer-or-name arg-name value)
  (let ((info '(:internal-border-width 10 :background-color "green")))
    (or (plist-get info arg-name) value)))

About

Pop a posframe (just a child-frame) at point

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 100.0%