diff options
Diffstat (limited to 'thogai.el')
-rw-r--r-- | thogai.el | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -91,6 +91,14 @@ to.") If non-nil, the next part of the translation is attached without a space, and the variable is reset to nil.") +(defvar thogai-glue + nil + "Flag indicating whether to glue the next translation. + +If non-nil and the next part of the translation also starts with +a glue operator, it is attached without a space, and the variable +is reset to nil.") + (defvar thogai-capitalize-next-word nil "Flag indicating whether to capitalize the next word. @@ -204,6 +212,14 @@ callers should never pass non-nil SUBTRANSLATION." (string-suffix-p "^}" str))) (insert (string-remove-prefix "{" (string-remove-suffix "^}" translation))) (setq thogai-attach-next t)) + ;; Glue operator + ((pred (lambda (str) + (and (string-prefix-p "{&" str) + (string-suffix-p "}" str)))) + (unless thogai-glue + (thogai-insert-space)) + (insert (string-remove-prefix "{&" (string-remove-suffix "}" translation))) + (setq thogai-glue t)) ;; Capitalize next word. ("{-|}" (setq thogai-capitalize-next-word t)) @@ -229,6 +245,9 @@ callers should never pass non-nil SUBTRANSLATION." (_ (unless subtranslation (thogai-insert-space)) + ;; Reset `thogai-attach-next' and `thogai-glue'. + (setq thogai-attach-next nil + thogai-glue nil) (insert (funcall (thogai-compose ;; Capitalize first letter. (if thogai-capitalize-next-word |