[comp.emacs] auto-mode-alist bug?/question

mesard@bbn.com (Wayne Mesard) (06/13/88)

I thought that the following in my auto-mode-alist, would match all
filenames that begin with a dot:

	("^\\." . fundamental-mode)

It doesn't seem to match anything.  Bug?  Suggestions?  This is 
GnuEmacs 18.51.5.

Also, would anyone care to provide a regexp that will only match filenames
which DO NOT contain a dot.

Thanks in advance.

I never met a file I couldn't (normal-mode).



-- 
unsigned *Wayne_Mesard();        MESARD@BBN.COM        BBN Labs, Cambridge, MA

"Republicans know they're not smart.
 What they do is try to get attention."
                                        -Mass. Senate President William Bulger.

maujd@warwick.UUCP (Geoff Rimmer) (06/27/88)

In article <25679@bbn.COM> mesard@BBN.COM writes:
>I thought that the following in my auto-mode-alist, would match all
>filenames that begin with a dot:
>
>	("^\\." . fundamental-mode)
>
>It doesn't seem to match anything.  Bug?  Suggestions?  This is 
>GnuEmacs 18.51.5.

I don't know anything about the auto-mode-alist thing, but surely the
regular expression to match something beginning with a dot would be

	"^\."
	  ^--------only 1 backslash

>Also, would anyone care to provide a regexp that will only match filenames
>which DO NOT contain a dot.

Try

	"^[^\.]"
	 ^ ^ ^------------- \. means match a dot
	 ^ ^--------------- this means negate the match
	 ^----------------- this means start of line

Geoff.

>unsigned *Wayne_Mesard();        MESARD@BBN.COM        BBN Labs, Cambridge, MA

	------------------------------------------------------------
	Geoff Rimmer, Computer Science, Warwick University, UK.
			maujd@uk.ac.warwick.opal

	"Innocence is lost too easily nowadays"
	"You can talk - your agent runs a brothel!"
		- Filthy Rich and Catflap (BBC TV)
	------------------------------------------------------------

mesard@bbn.com (Wayne Mesard) (06/29/88)

From article <724@ubu.warwick.UUCP>, by maujd@warwick.UUCP (Geoff Rimmer):
> In article <25679@bbn.COM> mesard@BBN.COM writes:
>}I thought that the following in my auto-mode-alist, would match all
>}filenames that begin with a dot:
>}
>}	("^\\." . fundamental-mode)
>}
>}It doesn't seem to match anything.  Bug?  Suggestions?  This is 
>}GnuEmacs 18.51.5.
> 
> I don't know anything about the auto-mode-alist thing, but surely the
> regular expression to match something beginning with a dot would be
> 
> 	"^\."
> 	  ^--------only 1 backslash
> 

Well, the first part of that sentence is correct, as to the rest, page
108 of my manual says (among other things), "Note that '\\' is needed in
Lisp syntax to include a '\' in the string, which is needed to suppress
the special meaning of '.' in regexps."

The solution you provide will match every filename with one or more
characters (most of them, I should think:-).

>}Also, would anyone care to provide a regexp that will only match filenames
>}which DO NOT contain a dot.
> 
[incorrect solution deleted.]

I tried "[^\\.]" before posting my 13 June article.  It doesn't match
anything.

So my questions still stand.  Is this a bug?  Any fixes?
Thanks.

> 	------------------------------------------------------------
> 	Geoff Rimmer, Computer Science, Warwick University, UK.
> 			maujd@uk.ac.warwick.opal

-- 
unsigned *Wayne_Mesard();        MESARD@BBN.COM        BBN Labs, Cambridge, MA

Is it because of the people you hang around with that you say you do not
need dan rather?
			M-x psychoanalyze-pinhead
(Gee, whataneditor!!)

rex@otto.lvsun.com (Rex Jolliff) (07/10/88)

>>}	("^\\." . fundamental-mode)

hmmm. this seems like it would match the string '.'.  I would think that a star
would be required to match th entire filename:

"^\\..*"

I haven't bothered with this, but now that I know about it, I think I'll hack
some extenions of my own in...

								Rex.



-- 

Rex Jolliff  (rex@otto.UUCP, {utah-gr, psivax, ihnp4, rutgers}!otto!rex)
The Sun Newspaper -            |Disclaimer:  The opinions and comments in
Nevada's Largest Daily Morning | this article are my own and in no way
Newspaper                      | reflect the opinions of my employers.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
What happened to our superior space program?