* save-excursion not working - despite NO-ERROR in search-forward-regexp
@ 2012-10-24 3:49 gnuist007
0 siblings, 0 replies; 3+ messages in thread
From: gnuist007 @ 2012-10-24 3:49 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: save-excursion not working - despite NO-ERROR in search-forward-regexp
[not found] <97bd72ac-9ff5-43f7-b1c4-c589a5bfe48f@r6g2000yqd.googlegroups.com>
@ 2012-10-24 12:53 ` Doug Lewan
[not found] ` <mailman.11594.1351083139.855.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Doug Lewan @ 2012-10-24 12:53 UTC (permalink / raw)
To: gnuist007@hotmail.com, help-gnu-emacs@gnu.org
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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: save-excursion not working - despite NO-ERROR in search-forward-regexp
[not found] ` <mailman.11594.1351083139.855.help-gnu-emacs@gnu.org>
@ 2012-10-25 2:54 ` gnuist007
0 siblings, 0 replies; 3+ messages in thread
From: gnuist007 @ 2012-10-25 2:54 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 24, 5:52 am, Doug Lewan <do...@shubertticketing.com> wrote:
> 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....@gnu.org
> > [mailto:help-gnu-emacs-bounces+dougl=shubertticketing....@gnu.org] On
> > Behalf Of gnuist...@hotmail.com
> > Sent: Tuesday, 2012 October 23 23:49
> > To: help-gnu-em...@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
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-25 2:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24 3:49 save-excursion not working - despite NO-ERROR in search-forward-regexp gnuist007
[not found] <97bd72ac-9ff5-43f7-b1c4-c589a5bfe48f@r6g2000yqd.googlegroups.com>
2012-10-24 12:53 ` Doug Lewan
[not found] ` <mailman.11594.1351083139.855.help-gnu-emacs@gnu.org>
2012-10-25 2:54 ` gnuist007
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).