all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Wingo <wingo@igalia.com>
To: 宋文武 <iyzsong@member.fsf.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] gnu-maintenance: update-package-source: Only update the desired package.
Date: Tue, 05 Apr 2016 16:52:31 +0200	[thread overview]
Message-ID: <87r3ekcdlc.fsf@igalia.com> (raw)
In-Reply-To: <87wpocup4w.fsf@member.fsf.org> ("宋文武"'s message of "Tue, 05 Apr 2016 22:05:51 +0800")

Hi :)

On Tue 05 Apr 2016 16:05, iyzsong@member.fsf.org (宋文武) writes:

> Andy Wingo <wingo@igalia.com> writes:
>
>> In that case I think the ideal is something like "edit-expression",
>> which takes a source location that starts an expression, uses "read" to
>> advance to the end of the expression, then edits the intervening string
>> using whatever but verifies that the result can still be read as one
>> expression.  Having recorded the absolute byte positions of the start
>> and end of the expression, you can then create the output by doing an
>> efficient bytevector read of the prologue, then display the string for
>> the edited expression, then the bytevector tail.
>>
>> Again, just a thought!  Feel free to incorporate or not as you like,
>> 宋文武 :)
> Indeed this is better!  To create the output from bytevector, it's
> using `get-bytevector-n' to read and `utf8->string' to write, right?

Hmm, good question.  I think I would use put-bytevector, if I read using
get-bytevector-n, assuming that the encoding of the input and the output
ports were the same.  Probably it is worth making sure that you set the
encodings to be the same, but I don't know :)  Hopefully everything is
UTF-8 these days.

> And I think `edit-expression' could be:
> (define (edit-expression source-properties proc)
>   "Edit the object specified by SOURCE-PROPERTIS using PROC, which
> should be a procedure that take the original object and returns
> a new one."
>   ...)

Yeah :)  However probably the "proc" should take and return a string, so
as to preserve formatting and comments.

Good luck :)

Andy

  reply	other threads:[~2016-04-05 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05  4:35 [PATCH] gnu-maintenance: update-package-source: Only update the desired package 宋文武
2016-04-05  8:25 ` Andy Wingo
2016-04-05  9:47   ` Ludovic Courtès
2016-04-05 10:16     ` Andy Wingo
2016-04-05 14:05       ` 宋文武
2016-04-05 14:52         ` Andy Wingo [this message]
2016-04-05 20:20       ` Ludovic Courtès
2016-04-05  9:45 ` Ludovic Courtès

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=87r3ekcdlc.fsf@igalia.com \
    --to=wingo@igalia.com \
    --cc=guix-devel@gnu.org \
    --cc=iyzsong@member.fsf.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/guix.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.