summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-11-07 14:22:15 +0200
committerEli Zaretskii <eliz@gnu.org>2021-11-07 14:22:15 +0200
commit75f4af0b303418f7bf107741684ea50b8c52b7f7 (patch)
tree1bb12abfdad3873168884811b605a3bbd6314ddd /lisp
parente9a5084c455e7f62c416a05841a6b51f69dd786b (diff)
downloademacs-75f4af0b303418f7bf107741684ea50b8c52b7f7.tar.gz
emacs-75f4af0b303418f7bf107741684ea50b8c52b7f7.tar.bz2
emacs-75f4af0b303418f7bf107741684ea50b8c52b7f7.zip
Improve detection of suspiciously reordered text segments
* src/bidi.c (bidi_find_first_overridden): Detect reordered weak and neutral characters as well. * lisp/international/mule-cmds.el (highlight-confusing-reorderings): Count and announce how many instances were found. * test/src/xdisp-tests.el (xdisp-tests--find-directional-overrides-case-3): New test. (xdisp-tests--find-directional-overrides-case-2): Adjust expected result.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/international/mule-cmds.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 7a6bfa58ada..089decb83c8 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -3318,7 +3318,8 @@ or the active region if that is set."
(prop-match-end prop-match)
'(font-lock-face face mouse-face
help-echo)))))
- (let (next)
+ (let ((count 0)
+ next)
(goto-char beg)
(while (setq next
(bidi-find-overridden-directionality
@@ -3358,6 +3359,15 @@ or the active region if that is set."
help-echo "\
This text is reordered on display in a way that could change its semantics;
use \\[forward-char] and \\[backward-char] to see the actual order of characters.")))
- (goto-char finish)))))))
+ (goto-char finish)
+ (setq count (1+ count))))
+ (message
+ (if (> count 0)
+ (ngettext
+ "Highlighted %d confusingly-reordered text string"
+ "Highlighted %d confusingly-reordered text strings"
+ count)
+ "No confusingly-reordered text strings were found")
+ count)))))
;;; mule-cmds.el ends here