Skip to content
Program with Personalized Notation
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
drafts
img
test
.gitignore Feature: Cask setup Feb 4, 2019
CONTRIBUTING.org
Cask
README.org
nt-base.el
nt-bounds.el Add: Root finding working! must add assertions to test contexts Mar 14, 2019
nt-change.el
nt-dev.el
nt-kwds.el Docs: Bit more detail in docstrings on keywords and note-defs Mar 18, 2019
nt-mask.el Clean: few nt-ov methods that weren't arrowed, ov-extend util Mar 18, 2019
nt-note.el Clean: Modularize the decomposition hooks Mar 18, 2019
nt-ov.el
nt.el

README.org

Notate - Program with Personalized Notation

(In-progress, current screenshot, see bottom for current project status)

./img/progress-2-stdize-height.png

Notate your programs with indentation-correcting visual replacements of symbols with other symbols.

Ligature’s generalization, known to Emacs as prettified-symbols, causes alignment and indentation issues, preventing one from rendering for as and int as in their code.

With notate, selectively APL-ize your code.

Introduction

Ligatures render consecutive graphemes, or characters, as a single glyph.

Fonts with programming ligatures, like Fira Code, design their ligature glyphs to have the same width as their constituent characters. The glyphs for >= and -> take up two spaces.

Matching sizes of operators and their replacements is not possible in general. For example, render and as :

(and foo   ; The actual text
     bar)
(∧ foo     ; What we see when working - bar isn't aligned!
     bar)
(∧ foo     ; What we want to see when working...
   bar)
(and foo   ; But now the true indentation is incorrect!
   bar)

There are many examples: render beta as β, in as , compose as , the “nameless” package, and so on.

Notate visually-only replaces strings with other strings, masking indentation.

Our working indentation is visually modified so that in the example above, we see example 3 while the true text is example 1. When we search for “and” it will jump to “∧”. When your coworker walks over, hiding your abominable operators is as simple as a toggle.

FAQ

Why?
I’ve found a hobby in confusing over-the-shoulder onlookers. I believe in the value of notation, as a graduate in math (go gators). The aesthetic of my programs are important to me.
Does Notate support all programming languages?
Yes-ish.
  • Details: notate is major-mode agnostic except for a fn to calculate the range of an indentation mask. This too can be made major-mode agnostic, however, a general implementation will be slower, more complex and potentially brittle. See nt-bounds.el.
How does it work?
By (ab)using particular properties of emacs’s display and modification-hooks text properties.
  • Details: My approach has received ‘praise’ from Emac’s maintainer in the past: “Using display properties and overlay strings to “fix” what the display engine does is fundamentally wrong, and is not what these features were designed for.”

    notate attempts to so egregiously abuse Emac’s display engine that a skilled user cannot help themselves but to correct me (by extending Emac’s C display engine with indentation metrics smarter than fixed-width columns).

    I’m joking - this project would complement and ideally inform an extension of Emac’s indentation engine and native ligature support. And in time, I will try my hand at it myself.

Similar work?
Notate is a novel extension of the concept of prettify-symbols, which itself has only a counterpart in vim-conceal. Notate is self-contained and cannot leverage prior work around the concept of prettifying.
Contributing?
Would be greatly appreciated! Non-coding materials like images, screencasts, and other examples are useful and exciting. For contributing code and raising issues, see CONTRIBUTING.

Goals

Graphemes, characters, ligatures, and glyphs can be confusing when used technically. I understand the least precise definition of ligatures to be: render consecutive characters as a specific character.

Emac’s built-in prettified-symbols-mode implements the natural generalization of this definition: render symbols as other symbols. This prior work cannot be used due to technical details surrounding choice of text properties. The term pretty-symbols is unique to Emacs, not widely known, and in my opinion, not serious enough for the possibilities it opens.

I want:

  • Discourse to move from “prettifying” to “notating” programming buffers.
  • Emac’s C display engine to eventually benefit from the challenges, performance considerations, and ideas presented in this work.
  • More imaginative notation, supported languages, and awareness of the possibilities Emacs offers and encourages.

Status

Lisp Status

  • Doesn’t yet recalculate masks on buffer modifications.
    • Insertion close to working, deletion not started.
  • Line movement needs to adjust for the indentation masks.
    • Moving point vertically across masks of different sizes will have horizontal movement as difference of the sizes.
  • Boundary functions need fleshing out.
    • Only for lisps at the moment and indentation cases not exhausted yet.
  • Either height or width is normalized, not both.
    • To see what I mean, compare the two progress-2 images in ./img. See the nt-normalize-height? variable for commentary.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.