Skip to content

mbatson/intono

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Intono - In(line) to(do) no(tes) for writing

Intono provides helper functions and (optionally) font-lock highlighting for inline todo notes useful in the writing and drafting of prose and poetry.

An inline todo note for Intono’s purposes is a markup construct that by default begins with the text, ((TODO: ​, and ends with )). Between these two elements the user can insert any text they want. This package provides functions to make the insertion and deletion of such notes in a buffer easy and convenient. It also provides a minor mode, intono-mode, which highlights inline todo notes with font-lock so that they are visually distinct from the surrounding text.

Inline todo notes do not need to be surrounded by whitespace, and in fact it is better if they are not. Here is an example of how inline todo notes might be used:

Shall I compare thee((TODO: modernise to “you”?)) to a summer’s day?((TODO: too clichéd, revise))

Note the absence of any additional whitespace between the inline todo note and the rest of the text. Using inline todo notes in this manner means that if they are stripped from a file (for example, with intono-delete-all-in-buffer), their removal will not leave redundant whitespace behind.

The point of this style of todo note is to enable the user to record notes or reminders relating to the immediate context of what they are writing, without breaking the writing flow to open another document. It has the bonus of recording notes so that they are embedded within the draft document, and in their original context, instead of recorded elsewhere in a place where they can be forgotten and that must be manually kept in sync with the actual draft.

How one works while writing is, however, highly personal. This package was developed for my own, particular way of working. This makes it rather niche. If you do find it useful though, or think it would be if only it was tweaked in this or that minor way, suggestions, contributions, and/or forks are of course always welcome.

Installation

  1. Download this repo to a directory of your choosing
  2. In your init.el insert:
    (add-to-list 'load-path "/PATH/TO/REPO")
    (require 'intono)
        

Getting Started

Inserting inline todo notes

The core of intono is the command intono-insert. This command inserts the markup for an inline todo note at point, and then places point inside the markup so you can immediately begin typing (this way, if you are anything like me, you can get it down before you forget what it was you needed to make a note about).

It is highly recommended to bind intono-insert to a key for ease of use. For example, to bind it to C-c i in all major modes, put something like this in your init.el:

(keymap-global-set "C-c i" 'intono-insert)

Or to bind it only when in text-mode and all derived modes (which includes org-mode and markdown-mode):

(add-hook 'text-mode-hook
          (lambda ()
           (keymap-set text-mode-map "C-c i" 'intono-insert)))

See Rebinding Keys in Your Init File in the GNU Emacs Manual for more info.

Font highlighting of inline todo notes

The other main piece of Intono is the minor mode, intono-mode, which highlights inline todo notes with the face, font-lock-comment-face.

Intono mode can be enabled manually for a single Emacs session in a single buffer with M-x intono-mode. Or it can be manually enabled globally for all text-mode (and modes derived from text-mode) buffers with M-x global-intono-mode (see below for how to customise the modes that global-intono-mode applies to).

If you want intono-mode to be automatically enabled in a particular mode put the following in your init.el file:

;; Enable intono-mode automatically in text-mode buffers (including modes derived from text-mode).
(add-hook 'text-mode-hook 'intono-mode)

Alternatively, enable global-intono-mode and (if needed) customise the setting global-intono-modes:

(global-intono-mode 1)
;; Optionally, customise the modes that global-intono-mode will enable intono-mode for.
(setopt global-intono-modes '(org-mode markdown-mode))

global-intono-modes is set to text-mode by default.

Configuration

Customising the syntax of inline todo notes

While inline todo notes were introduced as having two elements (((TODO: ​ and ))), there are really three elements that make up the syntax of inline todo notes:

  • The starting delimiter
  • An optional keyword
  • The ending delimiter.

The content of the note goes between the keyword (or the starting delimiter if there is no keyword set) and the ending delimiter. All three elements can be customised by the user.

If you only want to customise the syntax of inline todo notes for a specific file, or the files in a specific directory, see File Variables and Directory Variables in the GNU Emacs Manual.

(Note: I strongly advise when customising inline todo notes that you keep their syntax unique enough that a regular expression search for them will never match something else in your document as well. Otherwise, commands like intono-delete-all-in-buffer might delete content in your document it was not supposed to.)

Starting delimiter (intono-delimiter-start)

Default value: ((

Customise it to any string of characters you wish with setopt. For example, to change it to a single square bracket put the following in your init.el:

(setopt intono-delimiter-start "[")

Ending delimiter (intono-delimiter-end)

Default value: ))

Customise it just like above. For example:

(setopt intono-delimiter-end "]")

Keyword (intono-keyword)

Default value: TODO: ​

Customise it to any string of characters with setopt.

A small tip: if you always want a space between the keyword and the content of the note, include a trailing space in the value of intono-keyword (this is what the default value does).

If you do not want a keyword at all (i.e., you only want delimiter symbols as syntax), then set intono-keyword to the empty string, like so:

(setopt intono-keyword "")

About

Inline todo notes for writing in Emacs

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors