From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Tennant Newsgroups: gmane.emacs.help Subject: Re: (read (current-buffer)) returns an integer in a buffer full of text? Date: Wed, 29 Nov 2006 15:20:40 +0200 Message-ID: <87odqq75jr.fsf@dellboy.lap.top> References: <1164303070.530993.199230@k70g2000cwa.googlegroups.com> <1164724454.191296.147930@14g2000cws.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164806552 4369 80.91.229.2 (29 Nov 2006 13:22:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 29 Nov 2006 13:22:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 29 14:22:31 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GpPNd-0003EM-VJ for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Nov 2006 14:21:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpPNd-0006QA-CS for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Nov 2006 08:21:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GpPND-0006Fw-Ti for help-gnu-emacs@gnu.org; Wed, 29 Nov 2006 08:21:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GpPNC-0006Dr-9M for help-gnu-emacs@gnu.org; Wed, 29 Nov 2006 08:21:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpPNC-0006DK-5Y for help-gnu-emacs@gnu.org; Wed, 29 Nov 2006 08:21:14 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GpPNB-0004iB-3K for help-gnu-emacs@gnu.org; Wed, 29 Nov 2006 08:21:13 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GpPMl-00033E-KL for help-gnu-emacs@gnu.org; Wed, 29 Nov 2006 14:20:47 +0100 Original-Received: from 81.214.124.82 ([81.214.124.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Nov 2006 14:20:47 +0100 Original-Received: from sebyte by 81.214.124.82 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Nov 2006 14:20:47 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 45 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 81.214.124.82 User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux) Cancel-Lock: sha1:Ph2cAEr/nSwri4SLw3M7tqS5JiE= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:39092 Archived-At: Quoth "Robert Thorpe" : > 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