From 4f456c36a4b56dec2e7053ba1d3d0475b70ed3ac Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 16 Jun 2022 01:45:26 +0530 Subject: Implement capitalization carry prefix. * thogai.el (thogai-insert-translation): Implement capitalization carry prefix. --- thogai.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/thogai.el b/thogai.el index 06db17c..1803405 100644 --- a/thogai.el +++ b/thogai.el @@ -255,8 +255,14 @@ External callers should always pass nil as the value." ((pred (lambda (str) (string-suffix-p "^}" str))) (thogai-insert-translation - (concat (string-remove-prefix "{" (string-remove-suffix "^}" translation)) - "{^}") + (concat + (let ((unwrapped (string-remove-prefix "{" (string-remove-suffix "^}" translation)))) + ;; If `translation' is a capitalization carry prefix, wrap + ;; it up again. + (if (string-prefix-p "~|" unwrapped) + (concat "{" unwrapped "}") + unwrapped)) + "{^}") non-first-part-p)) ;; Carry capitalization. ((pred (lambda (str) -- cgit v1.2.3