|
From: | B. T. Raven |
Subject: | Re: ncr (numeric character reference) to unicode |
Date: | Thu, 16 Apr 2009 22:39:43 -0500 |
User-agent: | Thunderbird 2.0.0.21 (Windows/20090302) |
Kevin Rodgers wrote:
B. T. Raven wrote:(defalias 'xhc 'expand-html-encoded-chars) and then tried to do the same with this function: (defun reverse-string (beg end) (interactive "r") (setq str (buffer-substring beg end)) (apply #'string (nreverse (string-to-list str))))but it doesn't seem to work, although it doesn't produce errors in a traceback buffer. What am I missing?Miles' expand-html-encoded-chars function modifies the buffer, with replace-match. Your reverse-string function generates a value, butdoes not modify the buffer.
Yes, of course. That finally dawned on me. Thanks Kevin and Steve. This is finally what I want:
(defun reverse-string (str) (apply #'string (nreverse (string-to-list str)))) (defun reverse-region-by-line (beg end) (interactive "r") (save-excursion (goto-char beg) (while (and (< (point) end) (re-search-forward "\\=.*$" end t)) (replace-match (reverse-string (match-string 0))) (forward-line)))) But now I find that if I copy-paste from Emacs 23.0.90.1, the Greek letters αβγδ appear in Mozilla Tbird (here) in the original order but בִּּרֵאשׁיתבָּרָּאא לֹהִים אלתשָּׁמַיִם וְ אלת הָ ּאָרֶ ׃is automatically reversed without running the above command on its region. ??? Is there invisible bidi info in the string or is it just the fact that the characters are Hebrew that causes this?
[Prev in Thread] | Current Thread | [Next in Thread] |