* save-excursion not working - despite NO-ERROR in search-forward-regexp
@ 2012-10-24 3:49 gnuist007
2012-10-24 8:24 ` Kevin Brubeck Unhammer
0 siblings, 1 reply; 2+ messages in thread
From: gnuist007 @ 2012-10-24 3:49 UTC (permalink / raw)
To: info-gnus-english
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] 2+ messages in thread
* Re: save-excursion not working - despite NO-ERROR in search-forward-regexp
2012-10-24 3:49 save-excursion not working - despite NO-ERROR in search-forward-regexp gnuist007
@ 2012-10-24 8:24 ` Kevin Brubeck Unhammer
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Brubeck Unhammer @ 2012-10-24 8:24 UTC (permalink / raw)
To: info-gnus-english
gnuist007@hotmail.com writes:
> 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)
1. When I try this code, point does not move (save-excursion seems to
work for me, I'm running emacs 24.2.1).
2. `end-of-buffer' moves point to end of buffer, I think you want
`point-max'.
--
Kevin Brubeck Unhammer
GPG: 0x766AC60C
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-24 8:24 UTC | newest]
Thread overview: 2+ 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
2012-10-24 8:24 ` Kevin Brubeck Unhammer
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 NNTP newsgroup(s).