unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Robert Thorpe" <rthorpe@realworldtech.com>
Subject: Re: (read (current-buffer)) returns an integer in a buffer full of text?
Date: 28 Nov 2006 06:34:14 -0800	[thread overview]
Message-ID: <1164724454.191296.147930@14g2000cws.googlegroups.com> (raw)
In-Reply-To: <mailman.1205.1164687201.2155.help-gnu-emacs@gnu.org>

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))

  parent reply	other threads:[~2006-11-28 14:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.981.1164201541.2155.help-gnu-emacs@gnu.org>
2006-11-23 17:31 ` (read (current-buffer)) returns an integer in a buffer full of text? Robert Thorpe
2006-11-27 16:44   ` Kevin Rodgers
     [not found]   ` <mailman.1205.1164687201.2155.help-gnu-emacs@gnu.org>
2006-11-28 14:34     ` Robert Thorpe [this message]
2006-11-29 13:20       ` Sebastian Tennant
     [not found]       ` <mailman.1280.1164806477.2155.help-gnu-emacs@gnu.org>
2006-11-29 14:17         ` Robert Thorpe
2006-11-29 18:22           ` Kevin Rodgers
     [not found]           ` <mailman.1300.1164824626.2155.help-gnu-emacs@gnu.org>
2006-11-29 18:46             ` Robert Thorpe
2006-11-29 20:07               ` Peter Dyballa
     [not found]               ` <mailman.1309.1164830848.2155.help-gnu-emacs@gnu.org>
2006-11-30 10:43                 ` Robert Thorpe
2006-11-30 12:19                   ` Sebastian Tennant
2006-11-22 13:18 Sebastian Tennant

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=1164724454.191296.147930@14g2000cws.googlegroups.com \
    --to=rthorpe@realworldtech.com \
    /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.
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).