branch: externals/posframe commit de8386a05d90c97921d1c2122b7b390313f4ab84 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Add README.org --- README.md | 153 ------------------------------------------------------------ README.org | 114 ++++++++++++++++++++++++++++++++++++++++++++ posframe.el | 104 +---------------------------------------- 3 files changed, 115 insertions(+), 256 deletions(-) diff --git a/README.md b/README.md deleted file mode 100644 index 2db2601..0000000 --- a/README.md +++ /dev/null @@ -1,153 +0,0 @@ -Note: this file is auto converted from posframe.el by [el2org](https://github.com/tumashu/el2org), please do not edit it by hand!!! - - -# 目录 - -1. [Posframe README](#orgb128484) - 1. [What is posframe?](#org974e900) - 2. [Installation](#org038dda3) - 3. [Usage](#org9c07621) - 1. [Create a posframe](#orgb22c0ed) - 2. [Hide a posframe](#org92261d1) - 3. [Hide all posframes](#org98e9cb3) - 4. [Delete a posframe](#orgcb1cbf5) - 5. [Delete all posframes](#org707403c) - 6. [Customizing mouse pointer control](#orgfbacc1c) - 7. [Set fallback arguments of posframe-show](#org8ab97cf) - - -<a id="orgb128484"></a> - -# Posframe README - -<a href="http://elpa.gnu.org/packages/posframe.html"><img alt="GNU ELPA" src="https://elpa.gnu.org/packages/posframe.svg"/></a> - - -<a id="org974e900"></a> - -## 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: - -1. For MacOS users, posframe needs Emacs version >= 26.0.91 -2. GNOME users with GTK3 builds need Emacs 27 or later. - See variable \`posframe-gtk-resize-child-frames' - which auto-detects this configuration. - - More details: - - 1. [Fix some problems with moving and resizing child frames](https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-27&id=c49d379f17bcb0ce82604def2eaa04bda00bd5ec) - 2. [Emacs's set-frame-size can not work well with gnome-shell?](https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00343.html) - - - - -<a id="org038dda3"></a> - -## Installation - - (require 'posframe) - - -<a id="org9c07621"></a> - -## Usage - - -<a id="orgb22c0ed"></a> - -### 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 - - -<a id="org92261d1"></a> - -### Hide a posframe - - (posframe-hide " *my-posframe-buffer*") - - -<a id="org98e9cb3"></a> - -### Hide all posframes - - M-x posframe-hide-all - - -<a id="orgcb1cbf5"></a> - -### 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*") - - -<a id="org707403c"></a> - -### 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. - - -<a id="orgfbacc1c"></a> - -### 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) - - -<a id="org8ab97cf"></a> - -### 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))) - diff --git a/README.org b/README.org new file mode 100644 index 0000000..ac15938 --- /dev/null +++ b/README.org @@ -0,0 +1,114 @@ +# Created 2021-06-01 Tue 10:41 +#+TITLE: Pop a posframe (just a frame) at point +#+AUTHOR: Feng Shu + +#+html: <a href="http://elpa.gnu.org/packages/posframe.html"><img alt="GNU ELPA" src="https://elpa.gnu.org/packages/posframe.svg"/></a> + +* 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: +1. For MacOS users, posframe needs Emacs version >= 26.0.91 +2. GNOME users with GTK3 builds need Emacs 27 or later. + See variable `posframe-gtk-resize-child-frames' + which auto-detects this configuration. + + More details: + 1. [[https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-27&id=c49d379f17bcb0ce82604def2eaa04bda00bd5ec][Fix some problems with moving and resizing child frames]] + 2. [[https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00343.html][Emacs's set-frame-size can not work well with gnome-shell?]] + +[[file:./snapshots/posframe-1.png]] + +** Installation + +#+begin_example +(require 'posframe) +#+end_example + +** Usage + +*** Create a posframe + +**** Simple way +#+begin_example +(when (posframe-workable-p) + (posframe-show " *my-posframe-buffer*" + :string "This is a test" + :position (point))) +#+end_example + +**** Advanced way +#+begin_example +(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))) +#+end_example + +**** Arguments + +#+begin_example +C-h f posframe-show +#+end_example + +*** Hide a posframe +#+begin_example +(posframe-hide " *my-posframe-buffer*") +#+end_example + +*** Hide all posframes +#+begin_example +M-x posframe-hide-all +#+end_example + +*** Delete a posframe +1. Delete posframe and its buffer + #+begin_example + (posframe-delete " *my-posframe-buffer*") + #+end_example +2. Only delete the frame + #+begin_example + (posframe-delete-frame " *my-posframe-buffer*") + #+end_example +*** Delete all posframes +#+begin_example +M-x posframe-delete-all +#+end_example + +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: +#+begin_example +(setq posframe-mouse-banish nil) +#+end_example + +*** 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. + +#+begin_example +(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))) +#+end_example diff --git a/posframe.el b/posframe.el index 22bb953..2e55c82 100644 --- a/posframe.el +++ b/posframe.el @@ -24,14 +24,9 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. - ;;; Commentary: - ;; * Posframe README :README: -;; #+html: <a href="http://elpa.gnu.org/packages/posframe.html"><img alt="GNU ELPA" src="https://elpa.gnu.org/packages/posframe.svg"/></a> - -;; ** What is posframe? ;; Posframe can pop up a frame at point, this *posframe* is a ;; child-frame connected to its root window's buffer. @@ -39,104 +34,7 @@ ;; 1. It is fast enough for daily usage :-) ;; 2. It works well with CJK languages. -;; NOTE: -;; 1. For MacOS users, posframe needs Emacs version >= 26.0.91 -;; 2. GNOME users with GTK3 builds need Emacs 27 or later. -;; See variable `posframe-gtk-resize-child-frames' -;; which auto-detects this configuration. - -;; More details: -;; 1. [[https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-27&id=c49d379f17bcb0ce82604def2eaa04bda00bd5ec][Fix some problems with moving and resizing child frames]] -;; 2. [[https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00343.html][Emacs's set-frame-size can not work well with gnome-shell?]] - -;; [[./snapshots/posframe-1.png]] - -;; ** Installation - -;; #+BEGIN_EXAMPLE -;; (require 'posframe) -;; #+END_EXAMPLE - -;; ** Usage - -;; *** Create a posframe - -;; **** Simple way -;; #+BEGIN_EXAMPLE -;; (when (posframe-workable-p) -;; (posframe-show " *my-posframe-buffer*" -;; :string "This is a test" -;; :position (point))) -;; #+END_EXAMPLE - -;; **** Advanced way -;; #+BEGIN_EXAMPLE -;; (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))) -;; #+END_EXAMPLE - -;; **** Arguments - -;; #+BEGIN_EXAMPLE -;; C-h f posframe-show -;; #+END_EXAMPLE - -;; *** Hide a posframe -;; #+BEGIN_EXAMPLE -;; (posframe-hide " *my-posframe-buffer*") -;; #+END_EXAMPLE - -;; *** Hide all posframes -;; #+BEGIN_EXAMPLE -;; M-x posframe-hide-all -;; #+END_EXAMPLE - -;; *** Delete a posframe -;; 1. Delete posframe and its buffer -;; #+BEGIN_EXAMPLE -;; (posframe-delete " *my-posframe-buffer*") -;; #+END_EXAMPLE -;; 2. Only delete the frame -;; #+BEGIN_EXAMPLE -;; (posframe-delete-frame " *my-posframe-buffer*") -;; #+END_EXAMPLE -;; *** Delete all posframes -;; #+BEGIN_EXAMPLE -;; M-x posframe-delete-all -;; #+END_EXAMPLE - -;; 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: -;; #+BEGIN_EXAMPLE -;; (setq posframe-mouse-banish nil) -;; #+END_EXAMPLE - -;; *** 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. - -;; #+BEGIN_EXAMPLE -;; (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))) -;; #+END_EXAMPLE +;; More info please see: README.org ;;; Code: ;; * posframe's code :CODE: