[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TERRIBLE ERROR :: Invalid search bound - wrong side of point
From: |
bolega |
Subject: |
Re: TERRIBLE ERROR :: Invalid search bound - wrong side of point |
Date: |
Thu, 2 Jul 2009 21:46:31 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Jul 2, 8:42 pm, Pillsy <pillsb...@gmail.com> wrote:
> On Jul 2, 7:16 pm, bolega <gnuist...@gmail.com> wrote:
> [...]
>
> > I only want to replace this on one line such as the current line. I
> > could narrow to the line but is it really necessary ? Cant I just
> > specify the limits in replace-regexp ? Either there is something
> > seriously wrong with my understanding of emacs so I must pursue this
> > for the sake of learning.
>
> You should probably try comp.emacs or gnu.help.emacs, too, since this
> group focuses almost entirely on the Common Lisp dialect of Lisp.
> Nonetheless, I'll take a stab at answering your question.
>
> > I tried several variants:
> > (replace-regexp "$" "#" nil (line-beginning-position) (line-end-
> > position nil) )
> > (replace-regexp "$" "#" nil (line-beginning-position) (+ (line-end-
> > position nil) 1))
>
> Well, one thing that works is to capture the text of the line as a
> group, like so:
>
> (replace-regexp "^\\(.*\\)$" "\\1#"
> nil
> (line-beginning-position)
> (line-end-position))
>
> However, if you just want to stick a character onto the end of the
> line, why not just move the point there and insert the character
> instead of using regexps?
>
> (save-excursion (end-of-line) (insert "#"))
>
> HTH,
> Pillsy
There is something really crazy going on.
When I try your first suggestion,
(replace-regexp "^\\(.*\\)$" "\\1#" nil (line-beginning-position)
(line-end-position))
I get this error:
Debugger entered--Lisp error: (error "Invalid search bound (wrong side
of point)")
re-search-forward("^\\(.*\\)$" #<marker at 109804 in file.txt> t)
perform-replace("^\\(.*\\)$" "\\1#" nil t nil nil nil 109703 109803)
replace-regexp("^\\(.*\\)$" "\\1#" nil 109703 109803)
eval((replace-regexp "^\\(.*\\)$" "\\1#" nil (line-beginning-
position) (line-end-position)))
eval-last-sexp-1(nil)
eval-last-sexp(nil)
* call-interactively(eval-last-sexp)
I want to understand what is going on so I learn to trace and debug an
error than be doing endless work-arounds. Predictive programming is
desired - which works the first time !!!