Skip to content

pretty-mode/pretty-mode

Repository files navigation

Pretty Mode Readme

Re-display parts of the Emacs buffer as pretty Unicode symbols. Highly configurable and extendable

Installation

Install the ELPA package from MELPA.

Usage

(require 'pretty-mode)
; if you want to set it globally
(global-pretty-mode t)
; if you want to set it only for a specific mode
(add-hook 'my-pretty-language-hook 'turn-on-pretty-mode)

If you are using the Emacs package Swiper you might want to disable global-pretty-mode as it generates a lot of garbage: instead enable pretty mode on a per-mode basis with turn-on-pretty-mode.

Development

In your Cask file:

(source melpa)
(depends-on "pretty-mode")

Then run:

cask install
make test
cask exec emacs -q -L . -l .dev/init.el

Credits

  • Arthur Danskin released pretty-mode in 2008 which fontifies various symbols.
  • Dmitri Akatov served as a maintainer and added support for more symbols, more modes and customization.
  • Grant Rettke added support for some Lispy stuff, Unicode character documentation, and Unicode source references and serves as the current maintainer.

Related Packages

latex-pretty-symbols
Makes emacs display unicode characters instead of latex commands for a lot of the most usual symbols..
prettify-symbols-mode
Built into Emacs

Discussion

Why Use It?

Some programming languages are wordy. They require a lot of words to write functions and problems. Early on it helps because you understand what is happening. But once you understand how to program well with that language, all of those words just get in the way: they take up a lot of space doing things that have nothing to do with solving your problem. For example in most language you need to explicitly return the result of a function.

In both Java and R the word is return. It isn’t a big deal to write it and see it, but, you just don’t even really see it. You know where you are, that the function is over, and you are returning (at any point) so you don’t need a reminder. In a case like this then you might replace return with a Smalltalk or a fun . There are a lot of other cases.

Browse the code and look at what is available. You will find it easy to enable logical groups of characters like Mathematics or Greek to get started pretty quickly. If it doesn’t have what you need then try writing one yourself: it is really easy.

If you are having fun with it then you are doing it right.

Versus Other Packages

The elephant in the living room is the question of whether or not to use this package or prettify-symbols-mode which is built into Emacs. Most of the time the answer is easy: use the built in package. In this case however it requires some consideration on your part.

This package covers more symbols and is more flexible with how it does it. prettify-symbols-mode does less so on both parts, but eventually it will catch up.

My advice: get what you need from both.