unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: bolega <gnuist006@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: TERRIBLE ERROR :: Invalid search bound - wrong side of point
Date: Thu, 2 Jul 2009 21:46:31 -0700 (PDT)	[thread overview]
Message-ID: <025dee7e-208b-49c7-b0d9-641a75023a33@r33g2000yqn.googlegroups.com> (raw)
In-Reply-To: 30ad1c47-f7b3-4eaa-a374-47edff9a6831@26g2000yqk.googlegroups.com

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




  reply	other threads:[~2009-07-03  4:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02 23:16 TERRIBLE ERROR :: Invalid search bound - wrong side of point bolega
2009-07-02 23:35 ` bolega
2009-07-03  3:42 ` Pillsy
2009-07-03  4:46   ` bolega [this message]
2009-07-03  7:16     ` Thien-Thi Nguyen
2009-07-03  7:47 ` TomSW

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=025dee7e-208b-49c7-b0d9-641a75023a33@r33g2000yqn.googlegroups.com \
    --to=gnuist006@gmail.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.
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).