PBUI is a Presentation Based User Interface for Emacs.
This is work in progress.
(push "/home/marian/src/pbui/" load-path)
(use-package pbui
:bind
(("C-<return> <return>" . pbui-modal-mode))
:config (progn
(pbui-mode +1)
;; PBUI commands prefix
(define-key pbui-mode-map (kbd "C-<return>") 'pbui-command-map)))
A Presentation Based User Interface provides a uniform way of interacting with domain objects across applications.
In a PBUI, whenever a domain object is displayed, it gets attached to its printed representation. Then those domain objects can be selected by the user by clicking on their printed representation, and then run commands that work on the type of objects selected.
The way PBUI works is by letting the user select the presentations he wants to work on first, then run a command that works over those presentations.
An example of that could be to first select a bunch of files and a directory, then run some command that works with those arguments, like Move files to directory or Copy files to directory.
Use PBUI global commands/keybindings or enter PBUI modal mode with C-<return>.
The global mode pbui-mode is initialized in .emacs init file. It sets up PBUI commands bindings with a prefix key.
;; Enable PBUI mode globally
(pbui-mode +1)
;; PBUI commands prefix
(define-key pbui-mode-map (kbd "C-<return>") 'pbui-command-map)
This mode allows the operation on presentations across Emacs, but doesn’t provide any feedback when cursor or mouse move over presentations.
The pbui-interactive-mode provides the same key bindings as pbui-mode but also highlights presentations when moving the text cursor or mouse over them.
The pbui-modal-mode offers a set of “modal” key bindings after it is enabled.
By default, you can enter the modal mode using C-<return> <return>.
The modal keybindings are:
space: Select/unselect presentation at point.
x : Run commands with the selected presentations as arguments.
X : Ensure presentation at point is selected and run command after.
DEL: Clear the list of selected presentations.
n : Navigate to next presentation in current buffer.
b : Navigate to previous presentation in current buffer.
v: visualize a list of currently selected presentations.
ESC or q: exit the PBUI modal mode.
A presentation based demo application is included. It is a contacts management application that uses presentations for displaying contacts data.
(require 'pbui-contacts-app)
Then run contacts-app Emacs command to start the application.
Once the application start, enter PBUI mode. Select presentations and run commands.
PBUI includes a Dired extension that makes Dired presentation based.
To install:
(require 'pbui-dired)
After that, after entering PBUI mode, Dired files are highlighted as presentations.
A very powerful aspect of Presentation Based User Interfaces is that presentations can be combined between applications.
As an example, try selecting files in Dired (after enabling PBUI mode). Then select some users from the contacts demo application. Finally hit x and choose Send files by email command (this needs Thunderbird on Linux at the moment).
Developing Presentation Based applications is as easy as adding some specific text properties to inserted text in our application buffer. That’s it. There are no more requirements.
To make some application Presentation Based aware, there’s no need of requiring PBUI library, nor define any commands; only requirement is to attach application objects to the inserted text like explained below:
A presentation associates graphical output with application objects. In PBUI that is done via Emacs text properties; a text property named presentation is attached to the inserted buffer text. The property value is a property list with type and value keys. value can contain any application object; that’s the object associated to the presentation. type has the type of the presented object.
Some examples of this:
- presentation for an email object:
(insert (propertize "[email protected]" 'presentation '(type email value "[email protected]")))
- presentation for a file object:
(insert (propertize "/usr/bin/foo" 'presentation '(type file value "/usr/bin/foo")))
Presented object are processed using commands that work on those presented objects (presentation commands). Presentation commands are defined using def-presentation-command macro. Only those command that match the types of the selected presented objects are made available to the user for execution.
For example, this is the implemention of a presentation command for copying a selected file to a selected directory:
(def-presentation-command (standard-commands:copy-file-to-directory
:title "Copy file to directory"
:description "Copy file to directory")
((file file) (dir directory))
(copy-file file dir)
(message "File copied to directory"))
- Presentation Based User Interfaces - Ciccarelli, Eugene C.
- User Interface Management Systems: The CLIM Perspective - Ralf Möller.
- An Implementation of CLIM Presentation Types - Timothy Moore.
- Holland, Simon & Oppenheim, Daniel. (1999). Direct Combination.. 262-269.
- McCLIM is a user interface framework for Common Lisp that is presentation based.