Change Log of aLtCaPs
Apply alternating letter casing to convey sarcasm or mockery
This document contains the release notes for each tagged commit on the project's main git repository: https://git.sr.ht/~protesilaos/altcaps.
The newest release is at the top. For further details, please consult the manual: https://protesilaos.com/emacs/altcaps.
1.2.0 on 2023-09-22
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.
1.1.0 on 2022-11-28
New user option
Introduced the user option altcaps-force-character-casing
. It
forces the given letter casing for specified characters. Its value is
an alist of (CHARACTER . CASE)
pairs. CHARACTER
is a single
character (satisfies the characterp
condition), while CASE
is the
upcase
or downcase
symbol (code sample further below).
The idea is to always render certain characters in lower or upper case, in consideration of their legibility in context. For example, the default altcaps algorithm produces this:
iLlIcIt IlLiBeRaL sIlLiNeSs
Whereas if the value of this variable declares i
to always be
lowercase and L
uppercase, then we get this:
iLLiCiT iLLiBeRaL siLLiNeSs
The code to do this:
(setq altcaps-force-character-casing '((?i . downcase) (?l . upcase)))
Thanks to Cédric Barreteau for the idea of forcing a given letter case on specified characters. I think that giving users the option keeps our code simple, while providing a useful point of customisation.
Cédric is the author of the nvim-altcaps, which is a plugin for NeoVim
based on my altcaps
idea: https://github.com/cbarrete/nvim-altcaps.
Improvements to documentation
- Wrote a
README.md
which contains basic information about the project, including links to the official Git repos, its mirrors on GitHub/GitLab, as well as the project's mailing list. This file is useful for Git forges that have trouble parsing an Org file (the manual isREADME.org
, which the GNU ELPA machinery converts into a proper Info manual). - Added missing index entries to the manual for our commands and the new user option.
- Wrote this very
CHANGELOG.org
, which is helpful for those who inspect the Git repository.