all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: "gnuist007@hotmail.com" <gnuist007@hotmail.com>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: save-excursion not working - despite NO-ERROR in search-forward-regexp
Date: Wed, 24 Oct 2012 12:53:05 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9826952832@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <97bd72ac-9ff5-43f7-b1c4-c589a5bfe48f@r6g2000yqd.googlegroups.com>

Gnuist,

I think the problem is your use of (end-of-buffer) which is a function of motion, not location. It's *info* documentation also has this note: `*Warning:* Don't use this function in Lisp programs!'.

Try using (point-max) instead.

I hope this helps.

,Doug

> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of gnuist007@hotmail.com
> Sent: Tuesday, 2012 October 23 23:49
> To: help-gnu-emacs@gnu.org
> Subject: save-excursion not working - despite NO-ERROR in search-
> forward-regexp
> 
> Hello Everyone,
> 
> I am trying to search some regular expressions in a file and then to
> do some manipulations represented for now by a message only. I want to
> go till the eob and then dont want to hit error, so I have a t for NO-
> ERROR. However, I also want the cursor ie point to return where I
> started from, ie did C-x C-e, but I see that the cursor gets stuck
> somewhere else, a little above the eob, even though its wrapped in
> save-excursion. This is driving me crazy so please help me.
> 
> (save-excursion
>   (while
>       (search-forward-regexp (regexp-quote "does nott existt inn this
> file") (end-of-buffer) t)
>   (message "first")
> ))
> 
> If you have a better suggestion, I shall be glad to have it, but I
> also want someone to show a fix to the one I have posted.
> 
> gnuist
> 
> 




       reply	other threads:[~2012-10-24 12:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <97bd72ac-9ff5-43f7-b1c4-c589a5bfe48f@r6g2000yqd.googlegroups.com>
2012-10-24 12:53 ` Doug Lewan [this message]
     [not found] ` <mailman.11594.1351083139.855.help-gnu-emacs@gnu.org>
2012-10-25  2:54   ` save-excursion not working - despite NO-ERROR in search-forward-regexp gnuist007
2012-10-24  3:49 gnuist007
  -- strict thread matches above, loose matches on Subject: below --
2012-10-24  3:49 gnuist007

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=155DEC68569B714B86C2C7075F5EDA9826952832@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=gnuist007@hotmail.com \
    --cc=help-gnu-emacs@gnu.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/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.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.