unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* About "/" in the regexp
@ 2013-02-13  0:27 Xue Fuqiao
  2013-02-13  4:01 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Xue Fuqiao @ 2013-02-13  0:27 UTC (permalink / raw)
  To: help-gnu-emacs

In (info "(elisp) Auto Major Mode"), there is an example of how to prepend several pattern pairs to `auto-mode-alist':

          (setq auto-mode-alist
            (append
             ;; File name (within directory) starts with a dot.
             '(("/\\.[^/]*\\'" . fundamental-mode)
               ;; File name has no dot.
               ("/[^\\./]*\\'" . fundamental-mode)
                ...)
             auto-mode-alist))

I'm confused about the first "/" in the two regular expressions.  Why is there a slash character?  Can anybody help?  Thanks.

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: About "/" in the regexp
  2013-02-13  0:27 About "/" in the regexp Xue Fuqiao
@ 2013-02-13  4:01 ` Drew Adams
  2013-02-13 23:52   ` Xue Fuqiao
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2013-02-13  4:01 UTC (permalink / raw)
  To: 'Xue Fuqiao', help-gnu-emacs

>           (setq auto-mode-alist
>             (append
>              ;; File name (within directory) starts with a dot.
>              '(("/\\.[^/]*\\'" . fundamental-mode)
>                ;; File name has no dot.
>                ("/[^\\./]*\\'" . fundamental-mode)
>                 ...)
>              auto-mode-alist))
> 
> I'm confused about the first "/" in the two regular 
> expressions.  Why is there a slash character?  Can anybody 
> help?  Thanks.

It's for a file name "within [a] directory", e.g., /foobar.
The / is the directory separator.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: About "/" in the regexp
  2013-02-13  4:01 ` Drew Adams
@ 2013-02-13 23:52   ` Xue Fuqiao
  0 siblings, 0 replies; 3+ messages in thread
From: Xue Fuqiao @ 2013-02-13 23:52 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

On Tue, 12 Feb 2013 20:01:52 -0800
"Drew Adams" <drew.adams@oracle.com> wrote:

> >           (setq auto-mode-alist
> >             (append
> >              ;; File name (within directory) starts with a dot.
> >              '(("/\\.[^/]*\\'" . fundamental-mode)
> >                ;; File name has no dot.
> >                ("/[^\\./]*\\'" . fundamental-mode)
> >                 ...)
> >              auto-mode-alist))
> > 
> > I'm confused about the first "/" in the two regular 
> > expressions.
> It's for a file name "within [a] directory", e.g., /foobar.
> The / is the directory separator.

I see, thanks.

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-13 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13  0:27 About "/" in the regexp Xue Fuqiao
2013-02-13  4:01 ` Drew Adams
2013-02-13 23:52   ` Xue Fuqiao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).