help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: special-display-regexps


From: Drew Adams
Subject: RE: special-display-regexps
Date: Fri, 27 Apr 2007 08:06:06 -0700

> >> I'm trying to set up special display frames. I want to use if for the
> >> following buffers:
> >>
> >> *Completions*
> >> *Help*
> >> *help[R](functionname)*
> >>
> >> I've tried the following regexps:
> >> (setq special-display-regexps
> >>       '("^\\*Help\\*$"
> >>       "^\\*Completions\\*$"
> >>       "^\\*help\\[R\\]([a-z]*)\\*$"))
> >>
> >> This works fine for the first two, but the third doesn't catch. I've
> >> also tried with single \ and double \, as well as simpler things like
> >> "\*help.*" -- this works for regexp searches when I paste the buffer
> >> name into scratch, but they don't work for the special display. What
> >> am I doing wrong?
> >
> > "[*]Help[*]" etc. is simpler.
> >
> > You want the backslash to be in the string itself, so that the
> > * is escaped.
> > To put a single backslash into a string in Lisp, you need to
> > use \\\\. See node "Regexp Special" in the Elisp manual.
>
> This is really confusing now.
>
>  \\\\*$" matches *Completions*, although I'm not sure
>  why since it is actually the regexp ^*Completions*$, since the double
>  \ should get filtered out by the string reader??

My bad. \\* escapes the `*' OK. You need \\\\ only if you want to escape a
`\', that is, to have a `\' in the string. Here, you just want to escape the
`*'.

> and "^[*]help.*" still doesn't match *help[R](help-topic)* , but the
> same thing entered in a regexp search will match.

The problem with your original code was only this: You have [a-z]*, when you
need [-a-z]*. In your example, you have "(help-topic)", which includes the
character `-', which is not a lowercase letter.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]