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

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

Re: Error on http://www.gnu.org/software/emacs/elisp/html_node/Auto-Majo


From: Xah Lee
Subject: Re: Error on http://www.gnu.org/software/emacs/elisp/html_node/Auto-Major-Mode.html
Date: Tue, 25 Nov 2008 06:17:59 -0800 (PST)
User-agent: G2/1.0

On Nov 24, 6:47 am, Decebal <CLDWester...@gmail.com> wrote:
> On this page there is the following code:
>           (setq auto-mode-alist
>             (append
>              ;; File name (within directory) starts with a dot.
>              '(("/\\.[^/]*\\'" . fundamental-mode)
>                ;; File name has no dot.
>                ("[^\\./]*\\'" . fundamental-mode)
>                ;; File name ends in `.C'.
>                ("\\.C\\'" . c++-mode))
>              auto-mode-alist))
>
> But the rule for a file name without a dot should be:
>                ("/[^\\./]*\\'" . fundamental-mode)
>
> Where should I tell this so that the error could be modified?

Do Alt+x report-emacs-bug.

> Also on some places end of the filename is written like \\' and on
> other places like $. What is the difference between those two?

• How To Install Emacs Packages
  http://xahlee.org/emacs/emacs_installing_packages.html

Quote:

«
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))

Note: The double backslash in the string “\\.js\\'” is used to escape
the backslash. So, the regex engine just got “\.js\'”. The “\.” is to
match a period. The “\'” is one of emacs special regex syntax, to
match end of a string.
»

See:

• Regexp Backslash - GNU Emacs Lisp Reference Manual
  http://xahlee.org/elisp/Regexp-Backslash.html

Strictly speaking, using “\” is more proper, but often “$” works too
unless the file name contains newline char. (thanks to Barry who
explained this earlier here)

  Xah
∑ http://xahlee.org/

reply via email to

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