• Stars
    star
    496
  • Rank 88,807 (Top 2 %)
  • Language
    Emacs Lisp
  • Created almost 14 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Popup Window Manager for Emacs

MELPA MELPA Stable

popwin.el

CI

popwin is a popup window manager for Emacs which makes you free from the hell of annoying buffers such like *Help*, *Completions*, *compilation*, and etc.

Take an example. When you complete file names during find-file, the (annoying) *Completions* buffer will appear in a newly splitted window. You might understand the necessity of the window, but you may wonder why the window still remains after completion...

popwin resolves there problems. Windows of such temporary buffers will be shown as a popup window, and you can close them smoothly by typing C-g in anytime.

Screenshots

Before Popup Window After Popup Window

Installation

Melpa

This package is on MELPA, you can install it from there! (recommended)

Manually

Install popwin.el into your load-path directory. If you have install-elisp or auto-install, you may install popwin.el like:

;; install-elisp
(install-elisp "https://raw.github.com/m2ym/popwin-el/master/popwin.el")
;; auto-install
(auto-install-from-url "https://raw.github.com/m2ym/popwin-el/master/popwin.el")

And then add the following code into your .emacs:

(require 'popwin)
(popwin-mode 1)

popwin is tested under GNU Emacs 22 or later.

Basic Usage

Special buffers, for example *Help*, specified in popwin:special-display-config will be shown in a popup window. You can close the popup window by typing C-g or selecting other windows.

By default, *Help*, *Completions*, *compilation*, and *Occur* buffers will be shown in a popup window. Try M-x find-file and type TAB TAB. You may see a popup window at the bottom of the frame.

File Name Completion

Let me show other examples.

M-x occur

M-x compile

Customization

Please do M-x customize-group RET popwin RET and M-x customize-variable RET popwin:special-display-config RET. See the header of popwin.el, source code, and docstrings for more information.

Default Keymap

popwin provides a default keymap named popwin:keymap. You can use it like:

(global-set-key (kbd "C-z") popwin:keymap)

Keymap:

| Key    | Command                               |
|--------+---------------------------------------|
| b      | popwin:popup-buffer                   |
| l      | popwin:popup-last-buffer              |
| o      | popwin:display-buffer                 |
| C-b    | popwin:switch-to-last-buffer          |
| C-p    | popwin:original-pop-to-last-buffer    |
| C-o    | popwin:original-display-last-buffer   |
| SPC    | popwin:select-popup-window            |
| s      | popwin:stick-popup-window             |
| 0      | popwin:close-popup-window             |
| f, C-f | popwin:find-file                      |
| e      | popwin:messages                       |
| C-u    | popwin:universal-display              |
| 1      | popwin:one-window                     |

Special Display Config

popwin:special-display-config is a list of CONFIG. CONFIG may be a form of (PATTERN . KEYWORDS), where PATTERN is a pattern of specifying a buffer, and KEYWORDS is a list of a pair of key and value. PATTERN is a buffer name, a symbol specifying major-mode, or a predicate function which takes the buffer. If CONFIG is a string or a symbol, PATTERN will be CONFIG and KEYWORDS will be empty. Available keywords are following:

:regexp

: If the value is non-nil, PATTERN will be used as regexp to matching buffer.

:width, :height

: Specify width or height of the popup window. If no size specified, popwin:popup-window-width or popwin:popup-window-height will be used. See also position keyword.

:position

: The value must be one of (left top right bottom). The popup window will shown at the position of the frame. If no position specified, popwin:popup-window-position will be used.

:noselect

: If the value is non-nil, the popup window will not be selected when it is shown.

:dedicated

: If the value is non-nil, the popup window will be dedicated to the original popup buffer. In this case, when another buffer is selected in the popup window, the popup window will be closed immedicately and the selected buffer will be shown on the previously selected window.

:stick

: If the value is non-nil, the popup window will be stuck when it is shown.

:tail : If the value is non-nil, the popup window will show the last contents.

Examples

;; M-x anything
(setq anything-samewindow nil)
(push '("*anything*" :height 20) popwin:special-display-config)

;; M-x dired-jump-other-window
(push '(dired-mode :position top) popwin:special-display-config)

;; M-!
(push "*Shell Command Output*" popwin:special-display-config)

;; M-x compile
(push '(compilation-mode :noselect t) popwin:special-display-config)

;; slime
(push "*slime-apropos*" popwin:special-display-config)
(push "*slime-macroexpansion*" popwin:special-display-config)
(push "*slime-description*" popwin:special-display-config)
(push '("*slime-compilation*" :noselect t) popwin:special-display-config)
(push "*slime-xref*" popwin:special-display-config)
(push '(sldb-mode :stick t) popwin:special-display-config)
(push 'slime-repl-mode popwin:special-display-config)
(push 'slime-connection-list-mode popwin:special-display-config)

;; vc
(push "*vc-diff*" popwin:special-display-config)
(push "*vc-change-log*" popwin:special-display-config)

;; undo-tree
(push '(" *undo-tree*" :width 0.3 :position right) popwin:special-display-config)

Universal Display Config

popwin:universal-display-config is a special alternative value of popwin:special-display-config, which will be used when executing a command with M-x popwin:universal-display prefix. If you want to show a specific buffer in a popup window at the time, for example, you can do it with M-x popwin:universal-display RET C-x 4 C-o BUFNAME RET.

The default value is (t), meaning all of buffers with M-x popwin:universal-display prefix will be shown in a popup window.

Working with Other Extensions

Some extensions needs workaround for working with popwin.

YaTeX

misc/popwin-yatex.el helps you to show YaTeX related buffers in a popup window. Add the following code into .emacs.

(require 'popwin-yatex)

You may write a configuration like:

(push '("*YaTeX-typesetting*") popwin:special-display-config)

w3m

misc/popwin-w3m.el helps you to show specific pages with w3m in a popup window. Add the following code into .emacs.

(require 'popwin-w3m)

It is recommended to change browse-url-browser-function to popwin:w3m-browse-url.

(setq browse-url-browser-function 'popwin:w3m-browse-url)

popwin:w3m-browse-url is a function (and a command) displaying w3m buffers in a popup window if the given URL is matched with the rules.

The rules are described by popwin:w3m-special-display-config variable, which has almost same structure of popwin:special-display-config.

The difference is popwin:w3m-special-display-config takes an URL regular expression instead of a buffer pattern.

For example, if you want to show google search pages in a popup window, a configuration could be:

(push '("^http://www\\.google\\.com/.*$") popwin:w3m-special-display-config)

term.el

misc/popwin-term.el helps you to show term buffers in a popup window. Add the following code into .emacs.

(require 'popwin-term)

Then write a configuration like:

(push '(term-mode :position :top :height 16 :stick t) popwin:special-display-config)

Now, you can show a term buffer in a popup window with M-x popwin-term:term.

browse-kill-ring.el

misc/browse-kill-ring.el helps you to show *Kill Ring* buffer in a popup window. Add the following code into .emacs.

(require 'popwin-browse-kill-ring)

Then write a configuration like:

(push "*Kill Ring*" popwin:special-display-config)

M-x browse-kill-ring now shows *Kill Ring* buffer in a popup window.

windows.el

Do not load windows.el after loading popwin.el. Load windows.el first.

Basic Commands

Command: popwin:popup-buffer

Focely show the specified buffer in a popup window. popwin:special-display-config will be ignored.

Command: popwin:display-buffer

Show the specified buffer in a popup window if possible, meaning there is at least one matched configuration in popwin:special-display-config. Otherwise, fallback to display-buffer.

Command: popwin:display-last-buffer

Show the lastly shown buffer in a popup window.

Command: popwin:pop-to-buffer

Same as popwin:display-buffer, but behaves like pop-to-buffer.

Command: popwin:one-window

Same like C-x 1 except that C-g restore the original window configuration. This is useful when you see the contents of the popup window in full window temporarily.

Command: popup:find-file

find-file in a popup window.

Command: popwin:messages

Show *Messages* buffer in a popup window.

Basic API

Function: popwin:create-popup-window

popwin:create-popup-window &optional size position adjust => (master-window popup-window)

popwin:create-popup-window creates a popup window and return it with a master window. Master window is a window which is splitted when creating the popup window. A resposibility of closing the popup window is on developers.


Copyright (C) 2011-2015 Tomohiro Matsuyama <[email protected]>

More Repositories

1

god-mode

Minor mode for God-like command entering
Emacs Lisp
849
star
2

git-gutter

Emacs port of GitGutter which is Sublime Text Plugin
Emacs Lisp
830
star
3

helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
Emacs Lisp
688
star
4

org-page

[INACTIVE] A static site generator based on Emacs and org mode.
Emacs Lisp
673
star
5

helm-ag

The silver searcher with helm interface
Emacs Lisp
492
star
6

quickrun

Run command quickly. This packages is inspired quickrun.vim
Emacs Lisp
474
star
7

anzu

Emacs Port of anzu.vim
Emacs Lisp
414
star
8

emamux

tmux manipulation from Emacs
Emacs Lisp
265
star
9

ov

Overlay library for Emacs Lisp.
Emacs Lisp
211
star
10

helm-gtags

GNU GLOBAL helm interface
Emacs Lisp
204
star
11

direx

Directory Explorer for GNU Emacs
Emacs Lisp
204
star
12

terraform-mode

Major mode of Terraform configuration file
Emacs Lisp
194
star
13

git-gutter-fringe

Fringe version of git-gutter.el
Emacs Lisp
160
star
14

req-package

dependency management system on top of use-package
Emacs Lisp
153
star
15

git-messenger

Emacs Port of git-messenger.vim
Emacs Lisp
146
star
16

go-eldoc

eldoc for go language
Emacs Lisp
128
star
17

libegit2

Emacs bindings for libgit2
C
115
star
18

key-chord

Map pairs of simultaneously pressed keys to commands
Emacs Lisp
108
star
19

yascroll

Yet Another Scroll Bar Mode
Emacs Lisp
104
star
20

zoom-window

Zoom and Unzoom window
Emacs Lisp
102
star
21

company-jedi

Company backend for Python jedi
Emacs Lisp
100
star
22

swoop

Peculiar buffer navigation for Emacs
Emacs Lisp
90
star
23

org-redmine

Redmine tools using Emacs OrgMode
Emacs Lisp
83
star
24

dired-k

Highlighting dired buffer like k
Emacs Lisp
82
star
25

magit-gerrit

Magit plugin for Gerrit Code Review
Emacs Lisp
61
star
26

go-add-tags

Add field tags for struct fields
Emacs Lisp
59
star
27

pkg-info

Provide information about Emacs packages
Emacs Lisp
57
star
28

helm-css-scss

This emacs program makes your CSS/SCSS/LESS coding faster and easier than ever.
Emacs Lisp
54
star
29

smeargle

Highlighting Regions by Last Updated Time
Emacs Lisp
49
star
30

evil-anzu

anzu for Evil
Emacs Lisp
49
star
31

mongo

MongoDB driver for Emacs Lisp
Emacs Lisp
47
star
32

manage-minor-mode

Manage your minor-mode on the dedicated interface buffer. Emacs.
Emacs Lisp
47
star
33

gh-md

Render markdown using the github api
Emacs Lisp
46
star
34

farmhouse-themes

Hand-picked light and dark color theme for Emacs 24+
Emacs Lisp
43
star
35

go-direx

Tree style source code viewer for Go language
Emacs Lisp
40
star
36

undohist

Persistent Undo History for GNU Emacs
Emacs Lisp
40
star
37

helm-themes

Emacs theme selection with helm interface
Emacs Lisp
38
star
38

fontawesome

fontawesome utility
Emacs Lisp
33
star
39

go-impl

impl for Emacs
Emacs Lisp
32
star
40

ansible-doc

Ansible documentation for GNU Emacs
Emacs Lisp
32
star
41

sr-speedbar

Same frame speedbar
Emacs Lisp
31
star
42

fancy-battery

Display battery in Emacs Mode line
Emacs Lisp
31
star
43

cpp-auto-include

Insert and delete C++ header files automatically.
Emacs Lisp
31
star
44

helm-open-github

Utilities for opening github page
Emacs Lisp
29
star
45

ac-etags

etags/ctags completion source for auto-complete
Emacs Lisp
28
star
46

transpose-frame

Transpose windows arrangement in a frame
Emacs Lisp
26
star
47

osx-trash

Make Emacs' delete-by-moving-to-trash do what you expect it to do on OS X.
Emacs Lisp
26
star
48

ac-emoji

auto-complete source of Emoji
Emacs Lisp
25
star
49

ac-ispell

ispell/aspell completion source for auto-complete
Emacs Lisp
25
star
50

applescript-mode

Emacs mode for editing AppleScript
Emacs Lisp
24
star
51

codic

Codic for Emacs
Emacs Lisp
23
star
52

magit-svn

Git-Svn extension for Magit
Emacs Lisp
22
star
53

helm-pydoc

pydoc with helm interface
Emacs Lisp
20
star
54

evil-textobj-line

Evil Line text object
Emacs Lisp
18
star
55

ac-alchemist

auto-complete source of alchemist
Emacs Lisp
18
star
56

sourcemap

Sourmap parser in Emacs Lisp
Emacs Lisp
18
star
57

dart-mode

An Emacs mode for the Dart language
Dart
16
star
58

helm-ack

App::ack with helm interface
Emacs Lisp
13
star
59

helm-perldoc

perlpod with helm interface
Emacs Lisp
12
star
60

reverse-theme

Emacs color theme of reverse(like 'emacs --reverse-video')
Emacs Lisp
12
star
61

helm-github-issues

github issues with helm interface
Emacs Lisp
12
star
62

ac-capf

auto-complete source of completion-at-point
Emacs Lisp
12
star
63

sound-wav

Play wav file
Emacs Lisp
12
star
64

ac-racer

auto-complete source of racer
Emacs Lisp
10
star
65

qt-pro-mode

GNU Emacs major-mode for Qt build-system files
Emacs Lisp
9
star
66

popup-complete

Completion with popup-el
Emacs Lisp
9
star
67

splitjoin

Emacs port of splitjoin.vim
Emacs Lisp
8
star
68

miniedit

Enhanced editing for minibuffer fields
Emacs Lisp
8
star
69

helm-ispell

ispell completion with helm interface
Emacs Lisp
8
star
70

thingopt

Additional features of thingatpt.el
Emacs Lisp
8
star
71

helm-package

Listing ELPA packages with helm interface
Emacs Lisp
7
star
72

magit-p4

Magit plugin integrating git-p4 add-on.
Emacs Lisp
6
star
73

docean

Interact with DigitalOcean from Emacs
Emacs Lisp
6
star
74

pyimpsort

Sort python imports
Python
5
star
75

emamux-ruby-test

Ruby test with emamux
Emacs Lisp
5
star
76

octicons

Emacs octicons utility
Emacs Lisp
5
star
77

oberon

Major mode for editing Oberon/Oberon-2 program texts
Emacs Lisp
5
star
78

dedicated

A very simple minor mode for dedicated buffers
Emacs Lisp
4
star
79

haxe-mode

Major mode for editing Haxe files.
Emacs Lisp
4
star
80

helm-robe

Helm completing function for robe
Emacs Lisp
4
star
81

ert-expectations

The simplest unit test framework in the world
Emacs Lisp
4
star
82

keydef

A simpler way to define keys, with kbd syntax
Emacs Lisp
3
star
83

help-find-org-mode

Advise help functions to find org babel source blocks instead of tangled source
Emacs Lisp
3
star
84

test-more

Emacs Test framework like Perl's Test::More
Emacs Lisp
3
star
85

tree-mode

A mode to manage tree widgets
Emacs Lisp
3
star
86

showtip

Show tip at cursor
Emacs Lisp
3
star
87

import-popwin

Pop up buffer near by import statements with popwin
Emacs Lisp
3
star
88

literate-coffee-mode

Major mode for Literate CoffeeScript
Emacs Lisp
3
star
89

perl-utils

Emacs Perl utilities
Emacs Lisp
2
star
90

ltsv

LTSV for Emacs
Emacs Lisp
2
star
91

later-do

Execute lisp code ... later
Emacs Lisp
2
star
92

findr

Breadth-first file-finding facility for (X)Emacs
Emacs Lisp
2
star
93

org-json

Conversion between org and json
Emacs Lisp
2
star
94

dirtree

Directory tree views
Emacs Lisp
2
star
95

pylint

Minor mode for running `pylint'
Emacs Lisp
2
star
96

jedi-eldoc

Eldoc with emacs-jedi
Emacs Lisp
2
star
97

w32-browser

Run Windows application associated with a file
Emacs Lisp
2
star
98

setnu

Emacs Lisp
1
star
99

oddmuse

Edit pages on an Oddmuse wiki
Emacs Lisp
1
star
100

.github

Talk and learn about the Emacsorphanage
Makefile
1
star