diff options
| author | Eli Zaretskii | 2014-12-02 16:13:47 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2014-12-02 16:13:47 +0200 |
| commit | dd601050e7db69f322eea09d99751d8e6363b153 (patch) | |
| tree | 41457d53d1ea7c37e452c0c346177e6188bea0b2 /doc/lispref | |
| parent | a92789b1fccf7ae9a39ec1cc9316a18e01d905bb (diff) | |
| download | emacs-dd601050e7db69f322eea09d99751d8e6363b153.tar.gz emacs-dd601050e7db69f322eea09d99751d8e6363b153.zip | |
Allow to search for characters whose bidi directionality was overridden.
src/bidi.c (bidi_find_first_overridden): New function.
src/xdisp.c (Fbidi_find_overridden_directionality): New function.
(syms_of_xdisp): Defsubr it.
src/dispextern.h (bidi_find_first_overridden): Add prototype.
doc/lispref/display.texi (Bidirectional Display): Document
'bidi-find-overridden-directionality'.
etc/NEWS: Mention 'bidi-find-overridden-directionality'.
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 54 |
2 files changed, 59 insertions, 0 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 31a9cbf04e4..f98e457566e 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-12-02 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * display.texi (Bidirectional Display): Document | ||
| 4 | 'bidi-find-overridden-directionality'. | ||
| 5 | |||
| 1 | 2014-11-29 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2014-11-29 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | Lessen focus on ChangeLog files, as opposed to change log entries. | 8 | Lessen focus on ChangeLog files, as opposed to change log entries. |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 4cb06dd188f..59f73223a1f 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -6800,3 +6800,57 @@ affect all Emacs frames and windows. | |||
| 6800 | appropriate mirrored character in the reordered text. Lisp programs | 6800 | appropriate mirrored character in the reordered text. Lisp programs |
| 6801 | can affect the mirrored display by changing this property. Again, any | 6801 | can affect the mirrored display by changing this property. Again, any |
| 6802 | such changes affect all of Emacs display. | 6802 | such changes affect all of Emacs display. |
| 6803 | |||
| 6804 | @cindex overriding bidirectional properties | ||
| 6805 | @cindex directional overrides | ||
| 6806 | @cindex LRO | ||
| 6807 | @cindex RLO | ||
| 6808 | The bidirectional properties of characters can be overridden by | ||
| 6809 | inserting into the text special directional control characters, | ||
| 6810 | LEFT-TO-RIGHT OVERRIDE (@acronym{LRO}) and RIGHT-TO-LEFT OVERRIDE | ||
| 6811 | (@acronym{RLO}). Any characters between a @acronym{RLO} and the | ||
| 6812 | following newline or POP DIRECTIONAL FORMATTING (@acronym{PDF}) | ||
| 6813 | control character, whichever comes first, will be displayed as if they | ||
| 6814 | were strong right-to-left characters, i.e.@: they will be reversed on | ||
| 6815 | display. Similarly, any characters between @acronym{LRO} and | ||
| 6816 | @acronym{PDF} or newline will display as if they were strong | ||
| 6817 | left-to-right, and will @emph{not} be reversed even if they are strong | ||
| 6818 | right-to-left characters. | ||
| 6819 | |||
| 6820 | @cindex phishing using directional overrides | ||
| 6821 | @cindex malicious use of directional overrides | ||
| 6822 | These overrides are useful when you want to make some text | ||
| 6823 | unaffected by the reordering algorithm, and instead directly control | ||
| 6824 | the display order. But they can also be used for malicious purposes, | ||
| 6825 | known as @dfn{phishing}. Specifically, a URL on a Web page or a link | ||
| 6826 | in an email message can be manipulated to make its visual appearance | ||
| 6827 | unrecognizable, or similar to some popular benign location, while the | ||
| 6828 | real location, interpreted by a browser in the logical order, is very | ||
| 6829 | different. | ||
| 6830 | |||
| 6831 | Emacs provides a primitive that applications can use to detect | ||
| 6832 | instances of text whose bidirectional properties were overridden so as | ||
| 6833 | to make a left-to-right character display as if it were a | ||
| 6834 | right-to-left character, or vise versa. | ||
| 6835 | |||
| 6836 | @defun bidi-find-overridden-directionality from to &optional object | ||
| 6837 | This function looks at the text of the specified @var{object} between | ||
| 6838 | positions @var{from} (inclusive) and @var{to} (exclusive), and returns | ||
| 6839 | the first position where it finds a strong left-to-right character | ||
| 6840 | whose directional properties were forced to display the character as | ||
| 6841 | right-to-left, or for a strong right-to-left character that was forced | ||
| 6842 | to display as left-to-right. If it finds no such characters in the | ||
| 6843 | specified region of text, it returns @code{nil}. | ||
| 6844 | |||
| 6845 | The optional argument @var{object} specifies which text to search, and | ||
| 6846 | defaults to the current buffer. If @var{object} is non-@code{nil}, it | ||
| 6847 | can be some other buffer, or it can be a string or a window. If it is | ||
| 6848 | a string, the function searches that string. If it is a window, the | ||
| 6849 | function searches the buffer displayed in that window. If a buffer | ||
| 6850 | whose text you want to examine is displayed in some window, we | ||
| 6851 | recommend to specify it by that window, rather than pass the buffer to | ||
| 6852 | the function. This is because telling the function about the window | ||
| 6853 | allows it to correctly account for window-specific overlays, which | ||
| 6854 | might change the result of the function if some text in the buffer is | ||
| 6855 | covered by overlays. | ||
| 6856 | @end defun | ||