Package Contents

The following packages are currently available at the HELPA

Anti-Space Invader

Summary

Eradicates two spaces after period into single space

Background

Either one-space after period and single space after period are correct in sentence spacing. This script will make a life easier for those using single space when they come across documents prepared using two-spaces.

Limitations

This is simple search and replace, so it does not detect cases that such two-space after period usage may be legit. (Also, reverse conversion is not simple.)

References

Create Random Buffer

Summary

Creates an empty buffer with random numbered name.

Background

Just wanted to make extra “scratch” buffer.

Limitations

Does not handle buffer name collision.

Requires

Org Auxiliary Functions

Summary

Org Auxiliary Functions

Text Sanitizing Script

Summary

A simple script that sanitizes text

Background: Certain CMS system I use causes encoding issue when certain character, which would appear when original texts are prepared using word processor softwares. This script removes those texts with acceptable ones.

Function

Replaces unusable texts.

UTF-32 Support for Emacs

Summary

UTF-32 support for Emacs

Original code by

http://albinina.sakura.ne.jp/

Modifications

Changed name of each coding system so it is consistent with the rest.

UUID Generation Script

Summary

Based on http://ergoemacs.org/emacs/elisp_generate_uuid.html. Some function names are updated to fit my preference.

Dynamic Macro

Summary

Dynamic Macro system.

This version is modified with English version text.

Post installation setup

This script requires post installation setup.

Add something like the following in your .emacs (or your initialization script.)

You can specify your own choice of key mapping to invoke this feature.

(defconst *dmacro-key* "\C-t" "Repeat Key")
(global-set-key *dmacro-key* 'dmacro-exec)
(autoload 'dmacro-exec "dmacro" nil t)

How does this work?

tl;dr Type in some text and by pressing pre-determined key (Ctrl-T for the above setup) and your Emacs will execute what it think is the repeat of what you have previously done.

dmacro.el predicts user’s repeated input to predict the following input. *dmacro-key* defines “repeat key” which predicts detection and execution of the repeated commands.

For instance if the user type: abcabc and then press the “repeat key” and dmacro.el detects the repeated input of “abc” and then the resulting text will show: abcabcabc Another example, if the user type: abcdefab and then press the “repeat key” then dmacro.el determines this as a repetition of “abcdef” which completes the rest of the string, making the resulting text: abcdefabcdef Pressing the “repeat key” will cause the text will repeat “abcdef” making the resulting text: abcdefabcdefabcdef

All key inputs are considered and executed for example, given:

    line1
    line2
    line3
    line4
and then changing the above to:
    % line1
    % line2
    line3
    line4
and pressing “repeat key” will update the text:
    % line1
    % line2
    % line3
    line4
As you can see above, it will add “%” every time the “repeat key” is pressed.

You can think of this as if the keyboard macro is determined automatically by recognizing repeat pattern. Normally the keyboard macro requires user to specifically define them prior to their execution, but dmacro.el can execute such command even after the user realizes that he/she wants to repeats the previous input. Also the method of defining macro is simplified compared to the keyboard macro, which the user has to define begin/end of the macro.

Use examples

String replace

We’ll think of an example where you want to replace “abc” to “def.” Typical key input for searching “abc” is “Ctrl-S a b c ESC” and it can be replaced to “DEL DEL DEL d e f” to replace it to “def.” By pressing “repeat key” after the input of “Ctrl-S a b c ESC” the user can press the “repeat key” resulting “DEL DEL DEL d e f” is predicted to replace next “abc” with “def” as a result. Continuing to press the “repeat key” will change the next “abc” into “def” as well. Like the example above, “repeat key” can be used to sequentially replace strings one after another.

Drawing using lines

Repeating pattern can be drawn easily, for example:

─┐┌┐┌┐┌┐┌┐┌┐┌┐┌┐┌┐┌┐┌┐┌┐┌┐┌┐
└┘└┘└┘└┘└┘└┘└┘└┘└┘└┘└┘└┘└┘
You can use scripts like keisen.el and draw:
─┐┌┐
└┘
press the “repeat key” will make it:
─┐┌┐
└┘└┘
and pressing “repeat key” will update it:
─┐┌┐┌┐
└┘└┘└┘
Another example:
┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐
└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘
the drawing above can be created by just having the following:
┌─┐  ─
└─┘
then pressing the “repeat key” as needed.

Method of predicting repetition

There are many way to predict inputs, but dmacro.el prioritize this as the following:

(1) If there is a pattern that repeats twice immediately prior to the input of the “repeat key” then prioritize that. If there are multiple patterns that are repeating, prioritize the longer one. For the input of “teetee” it is possible to interpret this as repetition of “tee” or “ee” but in this case, it uses “tee” as a repetition.

(2) Without meeting the condition (1) previous input s is a part of the previous string, such as s t s then it will predict t first, then s t. At this time, it prioritize the longest s then the shortest t within.

For example “abracadabra” the longest one is s=“abra” the prediction will be s t=“cadabra” as a prioritized detection.

XEmacs compatibility, Super, Hyper, Alt key compatibility

This version supports XEmacs. Currently, it is tested with GNU Emacs 18, 19, 20, 21 XEmacs 21. Previous dmacro did not support Super, Hyper, Alt keys but this version supports these keys. It is possible to set *dmacro-key* to Super, Hyper, Alt, Meta but the following should be noted:

*dmacro-key* designation

For GNU Emacs

For XEmacs

Original code by