Emacs: aLtCaPs version 1.2.0
The altcaps
package is a small, focused-in-scope tool that helps
users communicate mockery or sarcasm effectively. It does this by
alternating the letter casing of characters in the words it affects.
- Package name (GNU ELPA):
altcaps
- Official manual: https://protesilaos.com/emacs/altcaps
- Change log: https://protesilaos.com/emacs/altcaps-changelog
- Git repo on SourceHut: https://git.sr.ht/~protesilaos/altcaps
- Mirrors:
- Mailing list: https://lists.sr.ht/~protesilaos/general-issues
- Backronyms: Alternating Letters Transform Casual Asides to Playful Statements. ALTCAPS Lets Trolls Convert Aphorisms to Proper Shitposts.
Below are the release notes.
Breaking change to the value of altcaps-force-character-casing
This user option enforces the specified letter casing for the given
character. The value is an alist. In previous versions, the car
of
each cell was a character type, whereas now it is a string type.
Concretely, the old value was expressed like this:
;; Old value
(setq altcaps-force-character-casing
'((?i . downcase)
(?l . upcase)))
It becomes:
;; New value
(setq altcaps-force-character-casing
'(("i" . downcase)
("l" . upcase)))
At least based on my correspondence, strings are easier for users. The notation for characters causes confusion.
The public altcaps-transform
function
This is the function that performs the alternating letter casing, while
also respecting the user option altcaps-force-character-casing
. The
function is more efficient now. Use it in Lisp with a single string
argument, like this:
(altcaps-transform "Your wish is my command")
;; => yOuR wIsH iS mY cOmMaNd
The above return value is consistent with the default settings. With
altcaps-force-character-casing
bound, we can affect the output thus:
(setq altcaps-force-character-casing
'(("i" . downcase)
("m" . upcase)))
(altcaps-transform "Your wish is my command")
;; => yOuR wiSh iS My CoMMaNd
Characters without casing no longer matter
Before, the algorithm was toggling the letter casing of virtually
every character. This means that a string like "a.c"
was wrongly
treated as a sequence of three characters with letter casing, so the
program was trying to do this:
a => downcase
. => upcase
c => downcase
Whereas now, the transformation skips characters without letter casing:
a => downcase
. => i Am ThE iNtElLiGeNtSiA nOw
c => upcase
The altcaps-replace
is superseded by altcaps-replace-region
The altcaps-replace
was not sufficiently abstract, making the code a
bit repetitive. The new altcaps-replace-region
is efficient in that
regard.
The arity of the two functions is different: altcaps-replace
was
accepting one required argument plus an optional one, while
altcaps-replace-region
takes three arguments at all times. Please
consult its doc string before adapting it to your code.