some simple tricks: boxquote, footnote and snip

When writing e-mails or other text documents, you can use a couple of tricks that are best explained by example.

boxquote


Dave Pearson wrote boxquote.el; what it does is most easily explained with some examples.

Suppose we select ('mark') some random text:

This is just some random text.This is just some random text.This is just
some random text.This is just some random text.This is just some random
text.

With M-x boxquote-region we get:

,----
| This is just some random text.This is just some random text.This is just
| some random text.This is just some random text.This is just some random
| text.
`----

I use boxquote-region regularly, to quote some text, to clearly separate it from the surrounding text.

footnotes


Also, I am regularly using footnote-mode. Footnote mode allows you to create footnotes in text documents, and it tries to keep the numbering up to date. Again, and example will make this clear. Suppose we have some text:
After his demonstration of wireless communication (radio) in 1894 and
after being the victor in the "War of Currents"[1], he was widely respected as
one of the greatest electrical engineers who worked in America.

When have the cursor ('point') on the right side of "War of the Currents", we can do Footnode-add-footnode. This will add (obviously without the 'See: ...'-part):

Footnotes:

[1] See: http://en.wikipedia.org/wiki/War_of_Currents

If you add multiple footnotes, footnote-mode updates the number.

Footnode-mode is part of emacs, and you can simply use M-x footnode-mode
to activate it.

snip


Finally, a little function for use in e-mails and other messages. For replying messages with questions or discussion points, it's good practice to answer them in-line (see the Trim-Posting Manifesto, for example), and to cut out or 'snip' parts that are no longer relevant. The following simple function may be helpful:
(defun djcb-snip (b e summ)
"remove selected lines, and replace it with [snip:summary (n lines)]"
(interactive "r\nsSummary:")
(let ((n (count-lines b e)))
(delete-region b e)
(insert (format "[snip%s (%d line%s)]"
(if (= 0 (length summ)) "" (concat ": " summ))
n
(if (= 1 n) "" "s")))))

When you select some text, and call the function (M-x djcb-snip or define a key binding), you're asked for a summary, and the text is replaced with something like:

[snip: irrelevant chatter (15 lines)]

No comments:

Post a Comment

Followers

Popular Posts