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

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

Re: Specifying a file in auto-mode-alist


From: Óscar Fuentes
Subject: Re: Specifying a file in auto-mode-alist
Date: Fri, 23 Apr 2021 22:42:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Patrick Mahan <plmahan@gmail.com> writes:

> All,
>
> I have build scripts that capture a build (makefile output) into files
> called build*.log or Build*.log. These files may occur at various points in
> the directory tree.
>
> However if I use the following:
>
> (add-to-list 'auto-mode-alist (quote("build*\\.log'" . compilation-mode)))
____________________________________________________^

> When I edit a file say 'build.log' it does not enable compilation mode.
>
> I tried -
>
> (add-to-list 'auto-mode-alist (quote("build*\\'" . compilation-mode)))
________________________________________________^

Why the ' ?

Try this regexp: "^[Bb]uild.*\\.log$"

That means: Starts with B or b followed by uild and then zero or more
arbitrary characters and ends with .log

(add-to-list 'auto-mode-alist '("^[Bb]uild.*\\.log$" . compilation-mode))




reply via email to

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