From: Pillsy <pillsbury@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: TERRIBLE ERROR :: Invalid search bound - wrong side of point
Date: Thu, 2 Jul 2009 20:42:00 -0700 (PDT) [thread overview]
Message-ID: <30ad1c47-f7b3-4eaa-a374-47edff9a6831@26g2000yqk.googlegroups.com> (raw)
In-Reply-To: ebd783c0-345e-4f6d-a967-ad225dc0a9c2@y7g2000yqa.googlegroups.com
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
next prev parent reply other threads:[~2009-07-03 3:42 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 [this message]
2009-07-03 4:46 ` bolega
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30ad1c47-f7b3-4eaa-a374-47edff9a6831@26g2000yqk.googlegroups.com \
--to=pillsbury@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.
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.