Compare commits
9 Commits
68818946a6
...
main
Author | SHA1 | Date | |
---|---|---|---|
8c396a11f5 | |||
e8b16420f8 | |||
7a75e73f88 | |||
3e37e3ad0c | |||
57a18de9aa | |||
23721d0a55 | |||
7514139d18 | |||
5ff002372b | |||
6de0e152eb |
20
README.org
20
README.org
@ -43,6 +43,26 @@ this utility:
|
||||
|
||||
* How?
|
||||
|
||||
** Installation
|
||||
|
||||
You can install pip-frame.el from [[https://melpa.org/#/pip-frame][MELPA]]. If you use [[https://github.com/radian-software/straight.el][straight.el]] and
|
||||
prefer using source repos directly, you can install pip-frame.el as
|
||||
follows:
|
||||
|
||||
#+begin_src elisp
|
||||
(straight-use-package
|
||||
'(pip-frame :type git
|
||||
:repo "https://git.zamazal.org/pdm/pip-frame"
|
||||
:local-repo "pip-frame"))
|
||||
#+end_src
|
||||
|
||||
For manual installation, simply put [[./pip-frame.el][pip-frame.el]] file to your
|
||||
=site-lisp= directory and add the following to your Emacs configuration:
|
||||
|
||||
#+begin_src elisp
|
||||
(require ’pip-frame)
|
||||
#+end_src
|
||||
|
||||
** Commands
|
||||
|
||||
The PIP frame is created using =M-x pip-frame-add-buffer= command. You
|
||||
|
19
pip-frame.el
19
pip-frame.el
@ -3,7 +3,8 @@
|
||||
;; Copyright (C) 2022 Milan Zamazal <pdm@zamazal.org>
|
||||
|
||||
;; Author: Milan Zamazal <pdm@zamazal.org>
|
||||
;; Package-Version: 1
|
||||
;; Version: 1
|
||||
;; Package-Requires: ((emacs "25.1"))
|
||||
;; Keywords: frames
|
||||
;; URL: https://git.zamazal.org/pdm/pip-frame
|
||||
|
||||
@ -32,6 +33,8 @@
|
||||
;; `M-x pip-frame-remove-buffer' or close the whole frame with
|
||||
;; `M-x pip-frame-delete-frame'.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup pip-frame ()
|
||||
@ -58,6 +61,7 @@ Usually, the value should be larger than 0 and much smaller than 1."
|
||||
(defcustom pip-frame-parameters
|
||||
'((left . 0.9)
|
||||
(top . 0.9)
|
||||
(tab-bar-lines . 0)
|
||||
(minibuffer . nil))
|
||||
"Alist of frame parameters to use for the PIP frame.
|
||||
The frame size is determined automatically using `pip-frame-scale'
|
||||
@ -171,7 +175,8 @@ If the buffer is not present in the PIP frame, do nothing."
|
||||
(interactive (list (completing-read "Remove PIP buffer: "
|
||||
(mapcar #'buffer-name (pip-frame--buffers))
|
||||
nil t)))
|
||||
(let* ((windows (window-list (pip-frame--get-frame)))
|
||||
(if-let ((frame (pip-frame--get-frame t))
|
||||
(windows (window-list frame))
|
||||
(buffer (get-buffer buffer-or-name))
|
||||
(windows-to-delete (cl-remove buffer windows
|
||||
:key #'window-buffer
|
||||
@ -192,18 +197,22 @@ If the buffer is not present in the PIP frame, do nothing."
|
||||
(round (* pip-frame-move-step (nth (if vertical 3 2) workarea))))))
|
||||
|
||||
(defun pip-frame-move-left ()
|
||||
"Move the PIP frame left."
|
||||
(interactive)
|
||||
(pip-frame--move (- (pip-frame--move-step nil)) 0))
|
||||
|
||||
(defun pip-frame-move-right ()
|
||||
"Move the PIP frame right."
|
||||
(interactive)
|
||||
(pip-frame--move (pip-frame--move-step nil) 0))
|
||||
|
||||
(defun pip-frame-move-up ()
|
||||
"Move the PIP frame up."
|
||||
(interactive)
|
||||
(pip-frame--move 0 (- (pip-frame--move-step t))))
|
||||
|
||||
(defun pip-frame-move-down ()
|
||||
"Move the PIP frame down."
|
||||
(interactive)
|
||||
(pip-frame--move 0 (pip-frame--move-step t)))
|
||||
|
||||
@ -224,3 +233,9 @@ Any other key stops this command and executes its own command."
|
||||
(set-transient-map pip-frame-move-map t))
|
||||
|
||||
(provide 'pip-frame)
|
||||
|
||||
;; Local Variables:
|
||||
;; checkdoc-force-docstrings-flag: nil
|
||||
;; End:
|
||||
|
||||
;;; pip-frame.el ends here
|
||||
|
Reference in New Issue
Block a user