From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Mule problem.
Date: 20 Aug 2004 16:31:08 -0400 [thread overview]
Message-ID: <jwvllg9a7fp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <x5hdqxh8y2.fsf@lola.goethe.zz>
> So I basically have to take the buffer line, convert it into a
> canonical form based on the byte sequence, take all the error
> messages, convert them into canonical form, too, correlate the errors
> in the messages with the canonical form, and then convert everything
> back.
> It would be most efficient if I could just place markers at the points
> of all error, and then call undo repeatedly until I arrive back at the
> original buffer line, then take a look at where the markers winded
> up. Unfortunately, this does not work.
I don't think there's a good generic answer. But in your case, IIUC you're
working on a single line, so maybe you can use something like:
- encode the buffer line to a sequence of bytes.
- figure out the error location(s).
- insert newlines at each error location.
- decode the sequence of bytes back to the "original buffer line"
plus newlines.
Obviously, you can't use `undo' here, so encode+decode should be a nop
(which is sadly not always the case with Emacs coding-systems).
> If the conversion functions could be given a (sorted) array of string
> positions, and would record where those positions moved to upon
> conversion, this would help quite a bit.
Note that you won't be able to use `undo' in any case, because `undo' will
just replace the canonical string with the unencoded string that was there
before (which has the same effect as decoding, but is done with a single
insert+delete and no knowledge of coding-systems), so it cannot properly
track markers that are in the middle of the changed text: those will end up
either at the beginning or at the end of the changed text.
Stefan
prev parent reply other threads:[~2004-08-20 20:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-20 20:05 Mule problem David Kastrup
2004-08-20 20:31 ` Stefan Monnier [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvllg9a7fp.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).