Function: bidi-string-mark-left-to-right
bidi-string-mark-left-to-right is a byte-compiled function defined in
subr.el.gz.
Signature
(bidi-string-mark-left-to-right STR)
Documentation
Return a string that can be safely inserted in left-to-right text.
Normally, inserting a string with right-to-left (RTL) script into a buffer may cause some subsequent text to be displayed as part of the RTL segment (usually this affects punctuation characters). This function returns a string that displays as STR but forces subsequent text to be displayed as left-to-right.
If STR contains any RTL character, this function returns a string
consisting of STR followed by an invisible left-to-right mark
(LRM) character. Otherwise, it returns STR.
Probably introduced at or before Emacs version 24.1.
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun bidi-string-mark-left-to-right (str)
"Return a string that can be safely inserted in left-to-right text.
Normally, inserting a string with right-to-left (RTL) script into
a buffer may cause some subsequent text to be displayed as part
of the RTL segment (usually this affects punctuation characters).
This function returns a string that displays as STR but forces
subsequent text to be displayed as left-to-right.
If STR contains any RTL character, this function returns a string
consisting of STR followed by an invisible left-to-right mark
\(LRM) character. Otherwise, it returns STR."
(unless (stringp str)
(signal 'wrong-type-argument (list 'stringp str)))
(if (string-match "\\cR" str)
(concat str (propertize (string ?\x200e) 'invisible t))
str))