[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (read (current-buffer)) returns an integer in a buffer full of text?
From: |
Sebastian Tennant |
Subject: |
Re: (read (current-buffer)) returns an integer in a buffer full of text? |
Date: |
Wed, 29 Nov 2006 15:20:40 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux) |
Quoth "Robert Thorpe" <rthorpe@realworldtech.com>:
> Kevin Rodgers wrote:
>> Robert Thorpe wrote:
>> > Sebastian Tennant wrote:
>> >> Hi everyone,
>> >>
>> >> If I execute the following code in *scratch* there's no problem:
>> >>
>> >> (with-temp-buffer
>> >> (insert "hello")
>> >> (backward-word)
>> >> (read (current-buffer)))
>> >> => hello
>> >
>> > The function with-temp-buffer creates a temp buffer for the duration of
>> > it's body. It does _not_ select that buffer as the current buffer.
>>
>> Why would that matter? The (read (current-buffer)) form is evaluated
>> while the temp buffer is current. Nothing depends on the temp buffer
>> still being current after that.
>
> You're right, my last sentence is 100% wrong. With-temp-buffer does
> set the temp buffer to be the current buffer.
>
> I have no idea why this code doesn't work, it works for me under
> similar conditions.
> (The only mistake is that (backward-word) should be (backward-word 1))
My error was in the location of point. If two words are separated by
a space, and point at the beginning of the second word,
'(backward-word 2)' is required to move point to the beginning of the
first word.
However, why does this happen:
(with-temp-buffer
(insert "586114704")
(backward-word)
(read (current-buffer)))
=> 49243792
Is there an integer limit relating to symbols somehow?
Sebastian
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Robert Thorpe, 2006/11/24
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Kevin Rodgers, 2006/11/27
- Message not available
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Robert Thorpe, 2006/11/28
- Re: (read (current-buffer)) returns an integer in a buffer full of text?,
Sebastian Tennant <=
- Message not available
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Robert Thorpe, 2006/11/29
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Kevin Rodgers, 2006/11/29
- Message not available
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Robert Thorpe, 2006/11/29
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Peter Dyballa, 2006/11/29
- Message not available
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Robert Thorpe, 2006/11/30
- Re: (read (current-buffer)) returns an integer in a buffer full of text?, Sebastian Tennant, 2006/11/30