all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Using re-builder
Date: Fri, 18 Jun 2004 10:05:00 -0600	[thread overview]
Message-ID: <40D312AC.4070208@yahoo.com> (raw)
In-Reply-To: 316044c2.0406180635.4b91e594@posting.google.com

Phil_C wrote:
 > Michael Slass <miknrene@drizzle.com> wrote in message news:<m3n031ol2b.fsf@eric.rossnet.com>...
 >>Try this:
 >>
 >>(defun reb-copy-unquoted ()
 >>  "Copy current RE into the kill ring for later insertion as unquoted."
 >>  (interactive)
 >>  (reb-update-regexp)
 >>  (let ((re (with-temp-buffer
 >>	      (insert (reb-target-binding reb-regexp))
 >>              (replace-string "\\\\" "\\" nil (point-min) (point-max))
 >>              (buffer-substring (point-min) (point-max)))))
 >>    (kill-new re)
 >>    (message "Regexp copied to kill-ring")))
 >
 > Thanks, that just about does it - except the beginning and ending
 > quotes are still there. Still, that's much better than it was before,
 > since now I don't have to go through the whole regex deleting "\"s.

Well, you could either replace "\\`\"" and "\"\\'" with "", or avoid
inserting them in the first place:

(let ((regexp (reb-target-binding reb-regexp)))
   (insert (substring regexp 1 (1- (length regexp)))))

Another approach would be to leave the regexp string in the kill ring,
but define a new command to yank the regexp itself into the minibuffer.

And instead of using replace-string to replace "\\\\" with "\\", you
might be able to get the lisp reader to do it for you (e.g. with
make-symbol).

-- 
Kevin Rodgers

  reply	other threads:[~2004-06-18 16:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-17 17:45 Using re-builder Phil_C
2004-06-17 22:51 ` Michael Slass
2004-06-18 14:35   ` Phil_C
2004-06-18 16:05     ` Kevin Rodgers [this message]
2004-06-18 17:08       ` Michael Slass
2004-06-18 18:54         ` Kevin Rodgers
2004-06-18 20:09           ` Michael Slass
2004-06-18  9:03 ` martin

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=40D312AC.4070208@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /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.