all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "B. T. Raven" <nihil@nihilo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: ncr (numeric character reference) to unicode
Date: Thu, 16 Apr 2009 22:39:43 -0500	[thread overview]
Message-ID: <QJOdneloWq1nZHrUnZ2dnUVZ_j-dnZ2d@sysmatrix.net> (raw)
In-Reply-To: <mailman.5427.1239855645.31690.help-gnu-emacs@gnu.org>

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, but
> does 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?


  parent reply	other threads:[~2009-04-17  3:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-13 20:17 ncr (numeric character reference) to unicode B. T. Raven
2009-04-13 20:52 ` Eli Zaretskii
2009-04-14  3:07 ` Miles Bader
2009-04-14 16:42   ` B. T. Raven
2009-04-15 21:43     ` Stephen Berman
     [not found]     ` <mailman.5401.1239831823.31690.help-gnu-emacs@gnu.org>
2009-04-16  1:42       ` B. T. Raven
2009-04-16  4:35         ` Kevin Rodgers
2009-04-16 13:23         ` Stephen Berman
2009-04-16  4:20     ` Kevin Rodgers
     [not found]     ` <mailman.5427.1239855645.31690.help-gnu-emacs@gnu.org>
2009-04-17  3:39       ` B. T. Raven [this message]
2009-04-17 15:19         ` Stephen Berman
     [not found]         ` <mailman.5538.1239981609.31690.help-gnu-emacs@gnu.org>
2009-04-17 23:20           ` B. T. Raven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=QJOdneloWq1nZHrUnZ2dnUVZ_j-dnZ2d@sysmatrix.net \
    --to=nihil@nihilo.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.