[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Passing buffers to function in elisp
From: |
tomas |
Subject: |
Re: [External] : Passing buffers to function in elisp |
Date: |
Wed, 22 Feb 2023 06:35:07 +0100 |
On Tue, Feb 21, 2023 at 11:21:47PM +0000, Drew Adams wrote:
> > I'm reading some bytes into a temp buffer, like so:
> >
> > (with-temp-buffer
> > (set-buffer-multibyte nil)
> > (insert-file-contents-literally filename nil 0 64000))
> >
> > then I pass these bytes to functions for processing, like this
> >
> > (func1 (buffer-string))
> >
> > or sometimes just part of them
> >
> > (func2 (substring (buffer-string) 100 200))
>
> Why aren't you passing the buffer itself to func1?
> Why aren't you passing the buffer itself and the limits 100 and 200 to func2?
>
> What is it that you're really trying to do?
That's exactly the point, yes.
> Yes, if you start manipulating strings instead of buffer text you will pay a
> performance penalty, in general.
...the question being whether it's worth it or not.
Sometimes it is, sometimes it isn't :-)
Cheers
--
t
signature.asc
Description: PGP signature
- Passing buffers to function in elisp, Petteri Hintsanen, 2023/02/21
- RE: [External] : Passing buffers to function in elisp, Drew Adams, 2023/02/21
- Re: [External] : Passing buffers to function in elisp,
tomas <=
- Re: [External] : Passing buffers to function in elisp, Petteri Hintsanen, 2023/02/24
- Re: [External] : Passing buffers to function in elisp, tomas, 2023/02/25
- Re: [External] : Passing buffers to function in elisp, Michael Heerdegen, 2023/02/25
- Re: [External] : Passing buffers to function in elisp, tomas, 2023/02/25
- Re: [External] : Passing buffers to function in elisp, Michael Heerdegen, 2023/02/25
- Re: [External] : Passing buffers to function in elisp, tomas, 2023/02/25
- Re: [External] : Passing buffers to function in elisp, Stefan Monnier, 2023/02/25
- Re: [External] : Passing buffers to function in elisp, Petteri Hintsanen, 2023/02/27
- Re: [External] : Passing buffers to function in elisp, tomas, 2023/02/28
Re: Passing buffers to function in elisp, tomas, 2023/02/22