Sorry for the offtopic, but I thought this homemade function I wrote some time ago for my work might perhaps be useful to some Orgers. When executed in a buffer, the `list-non-latin-chars' function opens a window displaying a list of all the non (basic) Latin characters present in that document. Each item in the list contains the character, its Unicode canonical name, and its hexadecimal code. For example:
殿 CJK IDEOGRAPH-6BBF #6bbf Also, each item is a button (created with button.el). If the button is activated, there are currently two options: a: execute occur on that character in the document; b : execute describe-char on that character. By default, the characters displayed in the list correspond to any Unicode block other than basic-latin. Which means that the zero width space character is included, a very famous character in this mailing list :-) And here is the code (lexical binding is required). Of course, feedback welcome. Best regards, Juan Manuel #+begin_src emacs-lisp (setq ext-chars-actions-list '((?a "Occur" (lambda (buf char) (interactive) (with-current-buffer buf (occur char)))) (?b "Describe char" (lambda (buf char) (interactive) (with-current-buffer buf (save-excursion (goto-char (point-min)) (when (re-search-forward char nil t) (describe-char (- (point) 1))))))))) (defun ext-chars-choose-action (buf char) (let ((opt (read-char-choice (concat "Escoger acción >>\n\n" (mapconcat (lambda (item) (format "%c: %s" (car item) (nth 1 item))) ext-chars-actions-list " --- ")) (mapcar #'car ext-chars-actions-list)))) (apply (nth 2 (assoc opt ext-chars-actions-list)) (list buf char)))) (defvar ext-chars-list nil) (defun list-non-latin-chars () (interactive) (setq ext-chars-list nil) (let ((buf (buffer-name))) (save-excursion (goto-char (point-min)) (while (re-search-forward "\\([^\u0000-\u007F]\\)" nil t) (add-to-list 'ext-chars-list (format "%s" (match-string 1)))) (setq ext-chars-list-final (mapcar (lambda (char) (let ((char-name (get-char-code-property (string-to-char char) 'name)) ;; convert to hexadecimal (char-code (format "#%x" (string-to-char char)))) (setq char (format "%s\s\s%s\s\s%s" char char-name char-code)))) ext-chars-list)) (let ((temp-buf (format "*non latin chars in %s*" buf))) (when (get-buffer temp-buf) (kill-buffer temp-buf)) (get-buffer-create temp-buf) (set-buffer temp-buf) ;; necessary for Arabic, Hebrew, etc. (setq bidi-display-reordering nil) ;; insert buttons list (mapc (lambda (el) (let ((char (when (string-match "^\\(.\\)\s" el) (match-string 1 el)))) (insert-button (format "%s" el) 'action (lambda (x) (interactive) (ext-chars-choose-action buf char))) (insert "\n\n"))) ext-chars-list-final) (pop-to-buffer temp-buf) (goto-char (point-min)) (view-mode))))) #+end_src -- -- ------------------------------------------------------ Juan Manuel Macías https://juanmanuelmacias.com https://lunotipia.juanmanuelmacias.com https://gnutas.juanmanuelmacias.com