Buffer interface library for Emacs
Alex Kost f3a137628e examples/buffers: Use default filters | преди 3 години | |
---|---|---|
examples | преди 3 години | |
.gitignore | преди 8 години | |
COPYING | преди 8 години | |
NEWS | преди 6 години | |
README.org | преди 7 години | |
bui-button.el | преди 8 години | |
bui-core.el | преди 3 години | |
bui-entry.el | преди 8 години | |
bui-history.el | преди 7 години | |
bui-info.el | преди 7 години | |
bui-list.el | преди 6 години | |
bui-utils.el | преди 3 години | |
bui.el | преди 6 години |
file:https://img.shields.io/badge/license-GPL_3-orange.svg file:http://melpa.org/packages/bui-badge.svg file:http://stable.melpa.org/packages/bui-badge.svg
BUI
(Buffer User Interface
) is an Emacs library that can be used to
make user interfaces to display some kind of entries (like packages,
buffers, functions, etc.).
The intention of BUI is to be a high-level library which is convenient to be used both by:
BUI provides means to display entries in 2 types of buffers:
list=: it is based on =tabulated-list-mode
, thus it looks similar toIn short, you define how a list
/ info
interface looks like (using
=bui-define-interface= macro), and then you can make some user commands
that will display entries (using bui-get-display-entries
and similar
functions).
For example, you can make a list
interface to display buffers (similar
to what M-x list-buffers
do), like this:
(require 'bui)
(defun buffers-buffer->entry (buffer)
(with-current-buffer buffer
`((id . ,buffer)
(name . ,(buffer-name))
(mode . ,major-mode)
(size . ,(buffer-size))
(file-name . ,buffer-file-name))))
(defun buffers-get-entries ()
(mapcar 'buffers-buffer->entry (buffer-list)))
(bui-define-interface buffers list
:buffer-name "*Buffers*"
:get-entries-function 'buffers-get-entries
:format '((name nil 30 t)
(mode nil 25 t)
(size nil 8 bui-list-sort-numerically-2 :right-align t)
(file-name bui-list-get-file-name 30 t))
:sort-key '(name))
(defun buffers ()
"Display a list of buffers."
(interactive)
(bui-get-display-entries 'buffers 'list))
This is a simplified example just to demonstrate how bui.el
can be
used. For full example see . You can see how
it looks like on the following screenshot. M-x buffers
displays a
list of buffers, then 2 buffers are marked (with m
key) and
"described" in info
buffer (with i
key).
http://i.imgur.com/3dlBu2Y.png
bui-define-interface
macro takes the following arguments:
list
or info
symbol.For real-world examples you may look at aurel or guix packages.