branch: externals/altcaps
commit 1c4bc74366d76a06cea5e7cab83280afb543f5c2
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Add user option altcaps-initial-case
---
README.org | 6 ++++++
altcaps.el | 18 ++++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index c4ba8b8712..68d4b597d7 100644
--- a/README.org
+++ b/README.org
@@ -218,6 +218,12 @@ The code to do this:
("l" . upcase)))
#+end_src
+#+vindex: altcaps-initial-case
+The user option ~altcaps-initial-case~ controls which letter case
+should come first while alternating betwen them. The value is the
+symbol =downcase= or =upcase=. Any other value is the same as
+=downcase=. [ The ~altcaps-initial-case~ is part of {{{development-version}}}.
]
+
* Acknowledgements
:PROPERTIES:
:CUSTOM_ID: h:399afb8b-7bb3-40b4-b10f-3123714d9614
diff --git a/altcaps.el b/altcaps.el
index a6c5ee3921..5a880dec6f 100644
--- a/altcaps.el
+++ b/altcaps.el
@@ -118,7 +118,9 @@ for a code sample):
You do want to communicate mockery or sarcasm, though legibility
still matters! (Regardless, I encourage everyone to use a decent
-font that disambiguates characters.)"
+font that disambiguates characters.)
+
+Also see `altcaps-initial-case'."
:type '(alist
:key-type (string :tag "Single character string")
:value-type (radio :tag "Letter casing"
@@ -127,12 +129,24 @@ font that disambiguates characters.)"
:package-version '(altcaps . "1.2.0")
:group 'altcaps)
+(defcustom altcaps-initial-case 'downcase
+ "Set the initial letter casing to alternate therefrom.
+The value is the symbol `downcase' or `upcase'. Anything else means
+`downcase'.
+
+Also see `altcaps-force-character-casing'."
+ :type '(choice
+ (const :tag "Start with lower case" downcase)
+ (const :tag "Start with upper case" upcase))
+ :package-version '(altcaps . "1.3.0")
+ :group 'altcaps)
+
(defun altcaps-transform (string)
"Make STRING use alternating letter casing, ignoring blanks.
Respect the preferred casing for characters in the user option
`altcaps-force-character-casing'."
(let ((characters (split-string (downcase string) ""))
- (casing nil)
+ (casing altcaps-initial-case)
(processed-characters nil))
(dolist (character characters)
(when (string-match-p "[[:alpha:]]" character)