Erlis Vidal <er...@erlisvidal.com> writes:
> Hi this is not a clojure question but I'm sure some one on this list can
> help me.
>
> I'm trying to write a regex using paredit and it looks like I cannot write
> something like this
>
> #"mypattern \d"
>
> whenever I type the character \ I see the text "Escaping character..." in
> the minibuffer. It is waiting for another character and then it uses the
> two characters as a single one, so I cannot delete only one, they are
> together.
>
> I see how this can be useful for strings, but for regex this is not
> helping.
>
> I end up writing my regex like (re-pattern "mypattern \\d") instead of
> using the short syntax.
>
> Any idea how can I write the short syntax using paredit?


You could advice paredit-backslash to only work in strings.
This function picks up that you are in a regexp.

(defun paredit-in-regexp-p (&optional state)
  "True if the parse state is within a double-quote-delimited string.
If no parse state is supplied, compute one from the beginning of the
  defun to the point."
  ;; 3. non-nil if inside a string (the terminator character, really)
  (and (paredit-in-string-p state)
       (save-excursion
         (skip-syntax-backward "^\"")
         (backward-char 2)
         (not
          (looking-at "#")))
       t))


Really paredit needs patching...

Phil

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to