Variable: auto-mode-alist

auto-mode-alist is a variable defined in files.el.gz.

Value

Large value
(("\\.ou?tl\\'" . outline-mode) ("\\.kotl?\\'" . kotl-mode)
 ("\\.liquid\\'" . liquid-generic-ts-mode)
 ("gitattributes\\'" . gitattributes-generic-ts-mode)
 ("/etc/conf\\.modules" . etc-modules-conf-generic-mode)
 ("/etc/modules\\.conf" . etc-modules-conf-generic-mode)
 ("/etc/resolve?\\.conf\\'" . resolve-conf-generic-mode)
 ("/etc/named\\.boot\\'" . named-boot-generic-mode)
 ("/etc/sudoers\\'" . etc-sudoers-generic-mode)
 ("/etc/[v]*fstab\\'" . etc-fstab-generic-mode)
 ("/etc/shadow-?\\'" . etc-passwd-generic-mode)
 ("/etc/group-?\\'" . etc-passwd-generic-mode)
 ("/etc/passwd-?\\'" . etc-passwd-generic-mode)
 ("/etc/services\\'" . etc-services-generic-mode)
 ("/etc/inetd\\.conf\\'" . inetd-conf-generic-mode)
 ("\\.mailrc\\'" . mailrc-generic-mode)
 ("inventory\\'" . ansible-inventory-generic-mode)
 ("alias\\'" . alias-generic-mode)
 ("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'"
  . java-manifest-generic-mode)
 ("\\.wrl\\'" . vrml-generic-mode)
 ("prototype\\'" . prototype-generic-mode)
 ("\\.rules\\'" . mailagent-rules-generic-mode)
 ("[hH][oO][sS][tT][sS]\\'" . hosts-generic-mode)
 ("[xX]modmap\\(rc\\)?\\'" . xmodmap-generic-mode)
 ("\\.ad\\'" . x-resource-generic-mode)
 ("\\.Xenvironment\\'" . x-resource-generic-mode)
 ("\\.Xresources\\'" . x-resource-generic-mode)
 ("\\.Xdefaults\\'" . x-resource-generic-mode)
 ("\\.fvwm2rc\\'" . fvwm-generic-mode)
 ("\\.fvwmrc\\'" . fvwm-generic-mode)
 ("smb\\.conf\\'" . samba-generic-mode)
 ("access_log\\'" . apache-log-generic-mode)
 ("access\\.conf\\'" . apache-conf-generic-mode)
 ("httpd\\.conf\\'" . apache-conf-generic-mode)
 ("srm\\.conf\\'" . apache-conf-generic-mode)
 ("\\.hva\\'" . LaTeX-mode)
 ("\\(?:build\\|profile\\)\\.boot\\'" . clojure-mode)
 ("\\.joke\\'" . joker-mode) ("\\.jank\\'" . jank-mode)
 ("\\.cljd\\'" . clojuredart-mode) ("\\.cljs\\'" . clojurescript-mode)
 ("\\.cljc\\'" . clojurec-mode) ("\\.edn\\'" . edn-mode)
 ("\\.\\(clj\\|dtm\\|lpy\\)\\'" . clojure-mode)
 ("/git-rebase-todo\\'" . git-rebase-mode)
 ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\|mdx\\)\\'"
  . markdown-mode)
 ("\\.elc\\'" . elisp-byte-code-mode)
 ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file)
 ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr)
 ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr)
 ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr)
 ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr)
 ("\\.ya?ml\\'" . yaml-ts-mode-maybe) ("\\.vr[hi]?\\'" . vera-mode)
 ("\\.tsx\\'" . tsx-ts-mode-maybe)
 ("\\.ts\\'" . typescript-ts-mode-maybe)
 ("\\.rs\\'" . rust-ts-mode-maybe)
 ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|axlsx\\|jbuilder\\|rabl\\|gemspec\\|podspec\\)\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Puppet\\|Berks\\|Brew\\|Fast\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'"
  . ruby-mode)
 ("\\.re?st\\'" . rst-mode)
 ("/\\(?:Pipfile\\|\\.?flake8\\)\\'" . conf-mode)
 ("\\(?:\\.\\(?:p\\(?:th\\|y[iw]?\\)\\)\\|/\\(?:SCons\\(?:\\(?:crip\\|truc\\)t\\)\\)\\)\\'"
  . python-mode)
 ("/\\.php_cs\\(?:\\.dist\\)?\\'" . php-ts-mode-maybe)
 ("\\.\\(?:php\\|inc\\|stub\\)\\'" . php-ts-mode-maybe)
 ("\\.\\(?:php[s345]?\\|phtml\\)\\'" . php-ts-mode-maybe)
 ("\\.m\\'" . octave-maybe-mode) ("\\.md\\'" . markdown-ts-mode-maybe)
 ("\\.lua\\'" . lua-mode) ("\\.less\\'" . less-css-mode)
 ("\\.[hl]?eex\\'" . heex-ts-mode-maybe)
 ("/go\\.work\\'" . go-work-ts-mode-maybe)
 ("/go\\.mod\\'" . go-mod-ts-mode-maybe)
 ("\\.go\\'" . go-ts-mode-maybe) ("mix\\.lock" . elixir-ts-mode-maybe)
 ("\\.exs\\'" . elixir-ts-mode-maybe)
 ("\\.ex\\'" . elixir-ts-mode-maybe)
 ("\\.elixir\\'" . elixir-ts-mode-maybe)
 ("\\.editorconfig\\'" . editorconfig-conf-mode)
 ("\\(?:\\(?:\\(?:Contain\\|Dock\\)erfile\\)\\(?:\\..*\\)?\\|\\.[Dd]ockerfile\\)\\'"
  . dockerfile-ts-mode-maybe)
 ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode)
 ("\\(?:CMakeLists\\.txt\\|\\.cmake\\)\\'" . cmake-ts-mode-maybe)
 ("\\.awk\\'" . awk-mode)
 ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode)
 ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode)
 ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode)
 ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode)
 ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode)
 ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode)
 ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)
 ("\\.\\(cc\\|hh\\)\\'" . c++-mode)
 ("\\.\\(bat\\|cmd\\)\\'" . bat-mode)
 ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode)
 ("\\.svgz?\\'" . image-mode) ("\\.svgz?\\'" . xml-mode)
 ("\\.x[bp]m\\'" . image-mode) ("\\.x[bp]m\\'" . c-mode)
 ("\\.p[bpgn]m\\'" . image-mode) ("\\.tiff?\\'" . image-mode)
 ("\\.gif\\'" . image-mode) ("\\.png\\'" . image-mode)
 ("\\.jpe?g\\'" . image-mode) ("\\.webp\\'" . image-mode)
 ("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode)
 ("\\.ins\\'" . tex-mode) ("\\.ltx\\'" . latex-mode)
 ("\\.dtx\\'" . doctex-mode) ("\\.org\\'" . org-mode)
 ("\\.dir-locals\\(?:-2\\)?\\.el\\'" . lisp-data-mode)
 ("\\.eld\\'" . lisp-data-mode) ("eww-bookmarks\\'" . lisp-data-mode)
 ("tramp\\'" . lisp-data-mode)
 ("/archive-contents\\'" . lisp-data-mode)
 ("places\\'" . lisp-data-mode)
 ("\\.emacs-places\\'" . lisp-data-mode)
 ("\\.el\\'" . emacs-lisp-mode) ("Project\\.ede\\'" . emacs-lisp-mode)
 ("\\(?:\\.\\(?:scm\\|sls\\|sld\\|stk\\|ss\\|sch\\)\\|/\\.guile\\)\\'"
  . scheme-mode)
 ("\\.l\\'" . lisp-mode) ("\\.li?sp\\'" . lisp-mode)
 ("\\.[fF]\\'" . fortran-mode) ("\\.for\\'" . fortran-mode)
 ("\\.p\\'" . pascal-mode) ("\\.pas\\'" . pascal-mode)
 ("\\.\\(dpr\\|DPR\\)\\'" . opascal-mode)
 ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
 ("Imakefile\\'" . makefile-imake-mode)
 ("Makeppfile\\(?:\\.mk\\)?\\'" . makefile-makepp-mode)
 ("\\.makepp\\'" . makefile-makepp-mode)
 ("\\.mk\\'" . makefile-gmake-mode)
 ("\\.make\\'" . makefile-gmake-mode)
 ("[Mm]akefile\\'" . makefile-gmake-mode)
 ("\\.am\\'" . makefile-automake-mode)
 ("\\.texinfo\\'" . texinfo-mode) ("\\.te?xi\\'" . texinfo-mode)
 ("\\.[sS]\\'" . asm-mode) ("\\.asm\\'" . asm-mode)
 ("\\.css\\'" . css-mode) ("\\.mixal\\'" . mixal-mode)
 ("\\.gcov\\'" . compilation-mode)
 ("/[._]?[A-Za-z0-9-]*\\(?:gdbinit\\(?:\\.\\(?:ini?\\|loader\\)\\)?\\|gdb\\.ini\\)\\'"
  . gdb-script-mode)
 ("-gdb\\.gdb" . gdb-script-mode)
 ("[cC]hange\\.?[lL]og?\\'" . change-log-mode)
 ("[cC]hange[lL]og[-.][0-9]+\\'" . change-log-mode)
 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode)
 ("\\.scm\\.[0-9]*\\'" . scheme-mode)
 ("\\.[ckz]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
 ("\\.bash\\'" . sh-mode)
 ("/bash-fc\\.[0-9A-Za-z]\\{6\\}\\'" . sh-mode)
 ("/PKGBUILD\\'" . sh-mode)
 ("\\(/\\|\\`\\)\\.\\(bash_\\(profile\\|history\\|log\\(in\\|out\\)\\)\\|z?log\\(in\\|out\\)\\)\\'"
  . sh-mode)
 ("\\(/\\|\\`\\)\\.\\(shrc\\|zshrc\\|m?kshrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'"
  . sh-mode)
 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'"
  . sh-mode)
 ("\\.m?spec\\'" . sh-mode) ("\\.m[mes]\\'" . nroff-mode)
 ("\\.man\\'" . nroff-mode) ("\\.sty\\'" . latex-mode)
 ("\\.cl[so]\\'" . latex-mode) ("\\.bbl\\'" . latex-mode)
 ("\\.bib\\'" . bibtex-mode) ("\\.bst\\'" . bibtex-style-mode)
 ("\\.sql\\'" . sql-mode)
 ("\\(acinclude\\|aclocal\\|acsite\\)\\.m4\\'" . autoconf-mode)
 ("\\.m[4c]\\'" . m4-mode) ("\\.mf\\'" . metafont-mode)
 ("\\.mp\\'" . metapost-mode) ("\\.vhdl?\\'" . vhdl-mode)
 ("\\.article\\'" . text-mode) ("\\.letter\\'" . text-mode)
 ("\\.i?tcl\\'" . tcl-mode) ("\\.exp\\'" . tcl-mode)
 ("\\.itk\\'" . tcl-mode) ("\\.icn\\'" . icon-mode)
 ("\\.sim\\'" . simula-mode) ("\\.mss\\'" . scribe-mode)
 ("\\.f9[05]\\'" . f90-mode) ("\\.f0[38]\\'" . f90-mode)
 ("\\.srt\\'" . srecode-template-mode) ("\\.prolog\\'" . prolog-mode)
 ("\\.tar\\'" . tar-mode)
 ("\\.\\(arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|cbr\\|7z\\|squashfs\\|ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'"
  . archive-mode)
 ("\\.oxt\\'" . archive-mode)
 ("\\.\\(deb\\|[oi]pk\\)\\'" . archive-mode)
 ("\\`/tmp/Re" . text-mode) ("/Message[0-9]*\\'" . text-mode)
 ("\\`/tmp/fol/" . text-mode) ("\\.oak\\'" . scheme-mode)
 ("\\.sgml?\\'" . sgml-mode) ("\\.x[ms]l\\'" . xml-mode)
 ("\\.slnx\\'" . xml-mode) ("\\.dbk\\'" . xml-mode)
 ("\\.dtd\\'" . sgml-mode) ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
 ("\\.js[mx]?\\'" . javascript-mode) ("\\.har\\'" . javascript-mode)
 ("\\.json\\'" . js-json-mode) ("\\.[ds]?va?h?\\'" . verilog-mode)
 ("\\.by\\'" . bovine-grammar-mode) ("\\.wy\\'" . wisent-grammar-mode)
 ("\\.erts\\'" . erts-mode)
 ("[:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode)
 ("\\`\\..*emacs\\'" . emacs-lisp-mode)
 ("[:/]_emacs\\'" . emacs-lisp-mode)
 ("/crontab\\.X*[0-9]+\\'" . shell-script-mode)
 ("\\.ml\\'" . lisp-mode) ("\\.ld[si]?\\'" . ld-script-mode)
 ("ld\\.?script\\'" . ld-script-mode) ("\\.xs\\'" . c-mode)
 ("\\.x[abdsru]?[cnw]?\\'" . ld-script-mode) ("\\.zone\\'" . dns-mode)
 ("\\.soa\\'" . dns-mode) ("\\.asd\\'" . lisp-mode)
 ("\\.\\(asn\\|mib\\|smi\\)\\'" . snmp-mode)
 ("\\.\\(as\\|mi\\|sm\\)2\\'" . snmpv2-mode)
 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
 ("\\.\\(dif\\|pat\\)\\'" . diff-mode)
 ("\\.[eE]?[pP][sS]\\'" . ps-mode)
 ("\\.\\(?:PDF\\|EPUB\\|CBZ\\|FB2\\|O?XPS\\|DVI\\|OD[FGPST]\\|DOCX\\|XLSX?\\|PPTX?\\|pdf\\|epub\\|cbz\\|fb2\\|o?xps\\|djvu\\|dvi\\|od[fgpst]\\|docx\\|xlsx?\\|pptx?\\)\\'"
  . doc-view-mode-maybe)
 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode)
 ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
 ("BROWSE\\'" . ebrowse-tree-mode)
 ("\\.ebrowse\\'" . ebrowse-tree-mode) ("#\\*mail\\*" . mail-mode)
 ("\\.g\\'" . antlr-mode) ("\\.g4\\'" . antlr-v4-mode)
 ("\\.mod\\'" . m2-mode) ("\\.ses\\'" . ses-mode)
 ("\\.docbook\\'" . sgml-mode) ("\\.com\\'" . dcl-mode)
 ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
 ("/\\.?\\(authinfo\\|netrc\\)\\'" . authinfo-mode)
 ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'"
  . conf-mode)
 ("\\.la\\'" . conf-unix-mode) ("\\.ppd\\'" . conf-ppd-mode)
 ("java.+\\.conf\\'" . conf-javaprop-mode)
 ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
 ("\\.toml\\'" . conf-toml-mode) ("\\.desktop\\'" . conf-desktop-mode)
 ("npmrc\\'" . conf-npmrc-mode)
 ("/\\.redshift\\.conf\\'" . conf-windows-mode)
 ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'"
  . conf-space-mode)
 ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'"
  . conf-mode)
 ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
 ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'"
  . conf-mode)
 ("/\\.mailmap\\'" . conf-unix-mode)
 ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'"
  . conf-mode)
 ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'"
  . conf-mode)
 ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
 ("/X11.+app-defaults/\\|\\.ad\\'" . conf-xdefaults-mode)
 ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
 ("/X11.+locale/compose\\.dir\\'" . conf-javaprop-mode)
 ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t)
 ("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t)
 ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'"
  . conf-mode-maybe)
 ("\\.[1-9]\\'" . nroff-mode) ("\\.avif\\'" . image-mode)
 ("\\.art\\'" . image-mode) ("\\.avs\\'" . image-mode)
 ("\\.bmp\\'" . image-mode) ("\\.cmyk\\'" . image-mode)
 ("\\.cmyka\\'" . image-mode) ("\\.crw\\'" . image-mode)
 ("\\.dcm\\'" . image-mode) ("\\.dcr\\'" . image-mode)
 ("\\.dcx\\'" . image-mode) ("\\.dng\\'" . image-mode)
 ("\\.dpx\\'" . image-mode) ("\\.fax\\'" . image-mode)
 ("\\.heic\\'" . image-mode) ("\\.hrz\\'" . image-mode)
 ("\\.icb\\'" . image-mode) ("\\.icc\\'" . image-mode)
 ("\\.icm\\'" . image-mode) ("\\.ico\\'" . image-mode)
 ("\\.icon\\'" . image-mode) ("\\.jbg\\'" . image-mode)
 ("\\.jbig\\'" . image-mode) ("\\.jng\\'" . image-mode)
 ("\\.jnx\\'" . image-mode) ("\\.miff\\'" . image-mode)
 ("\\.mng\\'" . image-mode) ("\\.mvg\\'" . image-mode)
 ("\\.otb\\'" . image-mode) ("\\.p7\\'" . image-mode)
 ("\\.pcx\\'" . image-mode) ("\\.pdb\\'" . image-mode)
 ("\\.pfa\\'" . image-mode) ("\\.pfb\\'" . image-mode)
 ("\\.picon\\'" . image-mode) ("\\.pict\\'" . image-mode)
 ("\\.rgb\\'" . image-mode) ("\\.rgba\\'" . image-mode)
 ("\\.six\\'" . image-mode) ("\\.tga\\'" . image-mode)
 ("\\.wbmp\\'" . image-mode) ("\\.wmf\\'" . image-mode)
 ("\\.wpg\\'" . image-mode) ("\\.xcf\\'" . image-mode)
 ("\\.xmp\\'" . image-mode) ("\\.xwd\\'" . image-mode)
 ("\\.yuv\\'" . image-mode) ("\\.tgz\\'" . tar-mode)
 ("\\.tbz2?\\'" . tar-mode) ("\\.txz\\'" . tar-mode)
 ("\\.tzst\\'" . tar-mode) ("\\.drv\\'" . LaTeX-mode))

Documentation

Alist of file name patterns vs corresponding major mode functions.

Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
(NON-NIL stands for anything that is not nil; the value does not matter.)
Visiting a file whose name matches REGEXP specifies FUNCTION as the mode function to use. FUNCTION will be called, unless it is nil.

If the element has the form (REGEXP FUNCTION NON-NIL), then after calling FUNCTION (if it's not nil), we delete the suffix that matched REGEXP and search the list again for another match.

The extensions whose FUNCTION is archive-mode should also appear in auto-coding-alist with no-conversion coding system.

See also interpreter-mode-alist, which detects executable script modes based on the interpreters they specify to run, and magic-mode-alist, which determines modes based on file contents.

View in manual

Probably introduced at or before Emacs version 17.

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defvar auto-mode-alist
  ;; Note: The entries for the modes defined in cc-mode.el (c-mode,
  ;; c++-mode, java-mode and more) are added through autoload
  ;; directives in that file.
  `(;; do this first, so that .html.pl is Polish html, not Perl
    ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode)
    ("\\.svgz?\\'" . image-mode)
    ("\\.svgz?\\'" . xml-mode)
    ("\\.x[bp]m\\'" . image-mode)
    ("\\.x[bp]m\\'" . c-mode)
    ("\\.p[bpgn]m\\'" . image-mode)
    ("\\.tiff?\\'" . image-mode)
    ("\\.gif\\'" . image-mode)
    ("\\.png\\'" . image-mode)
    ("\\.jpe?g\\'" . image-mode)
    ("\\.webp\\'" . image-mode)
    ("\\.te?xt\\'" . text-mode)
    ("\\.[tT]e[xX]\\'" . tex-mode)
    ("\\.ins\\'" . tex-mode)		;Installation files for TeX packages.
    ("\\.ltx\\'" . latex-mode)
    ("\\.dtx\\'" . doctex-mode)
    ("\\.org\\'" . org-mode)
    ;; .dir-locals.el is not really Elisp.  Could use the
    ;; `dir-locals-file' constant if it weren't defined below.
    ("\\.dir-locals\\(?:-2\\)?\\.el\\'" . lisp-data-mode)
    ("\\.eld\\'" . lisp-data-mode)
    ;; FIXME: The lisp-data-mode files below should use the `.eld' extension
    ;; (or a -*- mode cookie) so we don't need ad-hoc entries here.
    ("eww-bookmarks\\'" . lisp-data-mode)
    ("tramp\\'" . lisp-data-mode)
    ("/archive-contents\\'" . lisp-data-mode)
    ("places\\'" . lisp-data-mode)
    ("\\.emacs-places\\'" . lisp-data-mode)
    ("\\.el\\'" . emacs-lisp-mode)
    ("Project\\.ede\\'" . emacs-lisp-mode)
    ("\\(?:\\.\\(?:scm\\|sls\\|sld\\|stk\\|ss\\|sch\\)\\|/\\.guile\\)\\'" . scheme-mode)
    ("\\.l\\'" . lisp-mode)
    ("\\.li?sp\\'" . lisp-mode)
    ("\\.[fF]\\'" . fortran-mode)
    ("\\.for\\'" . fortran-mode)
    ("\\.p\\'" . pascal-mode)
    ("\\.pas\\'" . pascal-mode)
    ("\\.\\(dpr\\|DPR\\)\\'" . opascal-mode)
    ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
    ("Imakefile\\'" . makefile-imake-mode)
    ("Makeppfile\\(?:\\.mk\\)?\\'" . makefile-makepp-mode) ; Put this before .mk
    ("\\.makepp\\'" . makefile-makepp-mode)
    ,@(if (memq system-type '(berkeley-unix darwin))
	  '(("\\.mk\\'" . makefile-bsdmake-mode)
	    ("\\.make\\'" . makefile-bsdmake-mode)
	    ("GNUmakefile\\'" . makefile-gmake-mode)
	    ("[Mm]akefile\\'" . makefile-bsdmake-mode))
	'(("\\.mk\\'" . makefile-gmake-mode)	; Might be any make, give GNU the host advantage
	  ("\\.make\\'" . makefile-gmake-mode)
	  ("[Mm]akefile\\'" . makefile-gmake-mode)))
    ("\\.am\\'" . makefile-automake-mode)
    ;; Less common extensions come here
    ;; so more common ones above are found faster.
    ("\\.texinfo\\'" . texinfo-mode)
    ("\\.te?xi\\'" . texinfo-mode)
    ("\\.[sS]\\'" . asm-mode)
    ("\\.asm\\'" . asm-mode)
    ("\\.css\\'" . css-mode)
    ("\\.mixal\\'" . mixal-mode)
    ("\\.gcov\\'" . compilation-mode)
    ;; Besides .gdbinit, gdb documents other names to be usable for init
    ;; files, cross-debuggers can use something like
    ;; .PROCESSORNAME-gdbinit so that the host and target gdbinit files
    ;; don't interfere with each other.
    ("/[._]?[A-Za-z0-9-]*\\(?:gdbinit\\(?:\\.\\(?:ini?\\|loader\\)\\)?\\|gdb\\.ini\\)\\'" . gdb-script-mode)
    ;; GDB 7.5 introduced OBJFILE-gdb.gdb script files; e.g. a file
    ;; named 'emacs-gdb.gdb', if it exists, will be automatically
    ;; loaded when GDB reads an objfile called 'emacs'.
    ("-gdb\\.gdb" . gdb-script-mode)
    ("[cC]hange\\.?[lL]og?\\'" . change-log-mode)
    ("[cC]hange[lL]og[-.][0-9]+\\'" . change-log-mode)
    ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode)
    ("\\.scm\\.[0-9]*\\'" . scheme-mode)
    ("\\.[ckz]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
    ("\\.bash\\'" . sh-mode)
    ;; Bash builtin 'fc' creates a temp file named "bash-fc.XXXXXX"
    ;; to edit shell commands from its history list.
    ("/bash-fc\\.[0-9A-Za-z]\\{6\\}\\'" . sh-mode)
    ("/PKGBUILD\\'" . sh-mode)
    ("\\(/\\|\\`\\)\\.\\(bash_\\(profile\\|history\\|log\\(in\\|out\\)\\)\\|z?log\\(in\\|out\\)\\)\\'" . sh-mode)
    ("\\(/\\|\\`\\)\\.\\(shrc\\|zshrc\\|m?kshrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode)
    ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode)
    ("\\.m?spec\\'" . sh-mode)
    ("\\.m[mes]\\'" . nroff-mode)
    ("\\.man\\'" . nroff-mode)
    ("\\.sty\\'" . latex-mode)
    ("\\.cl[so]\\'" . latex-mode)		;LaTeX 2e class option
    ("\\.bbl\\'" . latex-mode)
    ("\\.bib\\'" . bibtex-mode)
    ("\\.bst\\'" . bibtex-style-mode)
    ("\\.sql\\'" . sql-mode)
    ;; These .m4 files are Autoconf files.
    ("\\(acinclude\\|aclocal\\|acsite\\)\\.m4\\'" . autoconf-mode)
    ("\\.m[4c]\\'" . m4-mode)
    ("\\.mf\\'" . metafont-mode)
    ("\\.mp\\'" . metapost-mode)
    ("\\.vhdl?\\'" . vhdl-mode)
    ("\\.article\\'" . text-mode)
    ("\\.letter\\'" . text-mode)
    ("\\.i?tcl\\'" . tcl-mode)
    ("\\.exp\\'" . tcl-mode)
    ("\\.itk\\'" . tcl-mode)
    ("\\.icn\\'" . icon-mode)
    ("\\.sim\\'" . simula-mode)
    ("\\.mss\\'" . scribe-mode)
    ;; The Fortran standard does not say anything about file extensions.
    ;; .f90 was widely used for F90, now we seem to be trapped into
    ;; using a different extension for each language revision.
    ;; Anyway, the following extensions are supported by gfortran.
    ("\\.f9[05]\\'" . f90-mode)
    ("\\.f0[38]\\'" . f90-mode)
    ("\\.srt\\'" . srecode-template-mode)
    ("\\.prolog\\'" . prolog-mode)
    ("\\.tar\\'" . tar-mode)
    ;; The list of archive file extensions should be in sync with
    ;; `auto-coding-alist' with `no-conversion' coding system.
    ("\\.\\(\
arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|cbr\\|7z\\|squashfs\\|\
ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" . archive-mode)
    ("\\.oxt\\'" . archive-mode) ;(Open|Libre)Office extensions.
    ("\\.\\(deb\\|[oi]pk\\)\\'" . archive-mode) ; Debian/Opkg packages.
    ;; Mailer puts message to be edited in
    ;; /tmp/Re.... or Message
    ("\\`/tmp/Re" . text-mode)
    ("/Message[0-9]*\\'" . text-mode)
    ;; some news reader is reported to use this
    ("\\`/tmp/fol/" . text-mode)
    ("\\.oak\\'" . scheme-mode)
    ("\\.sgml?\\'" . sgml-mode)
    ("\\.x[ms]l\\'" . xml-mode)
    ("\\.slnx\\'" . xml-mode)
    ("\\.dbk\\'" . xml-mode)
    ("\\.dtd\\'" . sgml-mode)
    ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
    ("\\.js[mx]?\\'" . javascript-mode)
    ;; https://en.wikipedia.org/wiki/.har
    ("\\.har\\'" . javascript-mode)
    ("\\.json\\'" . js-json-mode)
    ("\\.[ds]?va?h?\\'" . verilog-mode)
    ("\\.by\\'" . bovine-grammar-mode)
    ("\\.wy\\'" . wisent-grammar-mode)
    ("\\.erts\\'" . erts-mode)
    ;; .emacs or .gnus or .viper following a directory delimiter in
    ;; Unix or MS-DOS syntax.
    ("[:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode)
    ("\\`\\..*emacs\\'" . emacs-lisp-mode)
    ;; _emacs following a directory delimiter in MS-DOS syntax
    ("[:/]_emacs\\'" . emacs-lisp-mode)
    ("/crontab\\.X*[0-9]+\\'" . shell-script-mode)
    ("\\.ml\\'" . lisp-mode)
    ;; Linux-2.6.9 uses some different suffix for linker scripts:
    ;; "ld", "lds", "lds.S", "lds.in", "ld.script", and "ld.script.balo".
    ;; eCos uses "ld" and "ldi".  Netbsd uses "ldscript.*".
    ("\\.ld[si]?\\'" . ld-script-mode)
    ("ld\\.?script\\'" . ld-script-mode)
    ;; .xs is also used for ld scripts, but seems to be more commonly
    ;; associated with Perl .xs files (C with Perl bindings).  (Bug#7071)
    ("\\.xs\\'" . c-mode)
    ;; Explained in binutils ld/genscripts.sh.  Eg:
    ;; A .x script file is the default script.
    ;; A .xr script is for linking without relocation (-r flag).  Etc.
    ("\\.x[abdsru]?[cnw]?\\'" . ld-script-mode)
    ("\\.zone\\'" . dns-mode)
    ("\\.soa\\'" . dns-mode)
    ;; Common Lisp ASDF package system.
    ("\\.asd\\'" . lisp-mode)
    ("\\.\\(asn\\|mib\\|smi\\)\\'" . snmp-mode)
    ("\\.\\(as\\|mi\\|sm\\)2\\'" . snmpv2-mode)
    ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
    ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MS-DOS
    ("\\.[eE]?[pP][sS]\\'" . ps-mode)
    ("\\.\\(?:PDF\\|EPUB\\|CBZ\\|FB2\\|O?XPS\\|DVI\\|OD[FGPST]\\|DOCX\\|XLSX?\\|PPTX?\\|pdf\\|epub\\|cbz\\|fb2\\|o?xps\\|djvu\\|dvi\\|od[fgpst]\\|docx\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe)
    ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode)
    ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
    ("BROWSE\\'" . ebrowse-tree-mode)
    ("\\.ebrowse\\'" . ebrowse-tree-mode)
    ("#\\*mail\\*" . mail-mode)
    ("\\.g\\'" . antlr-mode)
    ("\\.g4\\'" . antlr-v4-mode)
    ("\\.mod\\'" . m2-mode)
    ("\\.ses\\'" . ses-mode)
    ("\\.docbook\\'" . sgml-mode)
    ("\\.com\\'" . dcl-mode)
    ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
    ("/\\.?\\(authinfo\\|netrc\\)\\'" . authinfo-mode)
    ;; Windows candidates may be opened case sensitively on Unix
    ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-mode)
    ("\\.la\\'" . conf-unix-mode)
    ("\\.ppd\\'" . conf-ppd-mode)
    ("java.+\\.conf\\'" . conf-javaprop-mode)
    ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
    ("\\.toml\\'" . conf-toml-mode)
    ("\\.desktop\\'" . conf-desktop-mode)
    ;; Dot is excluded from npmrc, because global configs may lack it,
    ;; e.g. in /etc/npmrc files.
    ("npmrc\\'" . conf-npmrc-mode)
    ("/\\.redshift\\.conf\\'" . conf-windows-mode)
    ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
    ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode)
    ;; ChangeLog.old etc.  Other change-log-mode entries are above;
    ;; this has lower priority to avoid matching changelog.sgml etc.
    ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
    ;; either user's dot-files or under /etc or some such
    ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode)
    ("/\\.mailmap\\'" . conf-unix-mode)
    ;; alas not all ~/.*rc files are like this
    ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode)
    ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode)
    ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
    ("/X11.+app-defaults/\\|\\.ad\\'" . conf-xdefaults-mode)
    ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
    ;; this contains everything twice, with space and with colon :-(
    ("/X11.+locale/compose\\.dir\\'" . conf-javaprop-mode)
    ;; Get rid of any trailing .n.m and try again.
    ;; This is for files saved by cvs-merge that look like .#<file>.<rev>
    ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~.
    ;; Using mode nil rather than `ignore' would let the search continue
    ;; through this list (with the shortened name) rather than start over.
    ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t)
    ("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t)
    ;; This should come after "in" stripping (e.g. config.h.in).
    ;; *.cf, *.cfg, *.conf, *.config[.local|.de_DE.UTF8|...], */config
    ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode-maybe)
    ;; The following should come after the ChangeLog pattern
    ;; for the sake of ChangeLog.1, etc.
    ;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too.
    ("\\.[1-9]\\'" . nroff-mode)
    ;; Image file types probably supported by `image-convert'.
    ("\\.avif\\'" . image-mode)
    ("\\.art\\'" . image-mode)
    ("\\.avs\\'" . image-mode)
    ("\\.bmp\\'" . image-mode)
    ("\\.cmyk\\'" . image-mode)
    ("\\.cmyka\\'" . image-mode)
    ("\\.crw\\'" . image-mode)
    ("\\.dcm\\'" . image-mode)
    ("\\.dcr\\'" . image-mode)
    ("\\.dcx\\'" . image-mode)
    ("\\.dng\\'" . image-mode)
    ("\\.dpx\\'" . image-mode)
    ("\\.fax\\'" . image-mode)
    ("\\.heic\\'" . image-mode)
    ("\\.hrz\\'" . image-mode)
    ("\\.icb\\'" . image-mode)
    ("\\.icc\\'" . image-mode)
    ("\\.icm\\'" . image-mode)
    ("\\.ico\\'" . image-mode)
    ("\\.icon\\'" . image-mode)
    ("\\.jbg\\'" . image-mode)
    ("\\.jbig\\'" . image-mode)
    ("\\.jng\\'" . image-mode)
    ("\\.jnx\\'" . image-mode)
    ("\\.miff\\'" . image-mode)
    ("\\.mng\\'" . image-mode)
    ("\\.mvg\\'" . image-mode)
    ("\\.otb\\'" . image-mode)
    ("\\.p7\\'" . image-mode)
    ("\\.pcx\\'" . image-mode)
    ("\\.pdb\\'" . image-mode)
    ("\\.pfa\\'" . image-mode)
    ("\\.pfb\\'" . image-mode)
    ("\\.picon\\'" . image-mode)
    ("\\.pict\\'" . image-mode)
    ("\\.rgb\\'" . image-mode)
    ("\\.rgba\\'" . image-mode)
    ("\\.six\\'" . image-mode)
    ("\\.tga\\'" . image-mode)
    ("\\.wbmp\\'" . image-mode)
    ("\\.wmf\\'" . image-mode)
    ("\\.wpg\\'" . image-mode)
    ("\\.xcf\\'" . image-mode)
    ("\\.xmp\\'" . image-mode)
    ("\\.xwd\\'" . image-mode)
    ("\\.yuv\\'" . image-mode))
  "Alist of file name patterns vs corresponding major mode functions.
Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
\(NON-NIL stands for anything that is not nil; the value does not matter.)
Visiting a file whose name matches REGEXP specifies FUNCTION as the
mode function to use.  FUNCTION will be called, unless it is nil.

If the element has the form (REGEXP FUNCTION NON-NIL), then after
calling FUNCTION (if it's not nil), we delete the suffix that matched
REGEXP and search the list again for another match.

The extensions whose FUNCTION is `archive-mode' should also
appear in `auto-coding-alist' with `no-conversion' coding system.

See also `interpreter-mode-alist', which detects executable script modes
based on the interpreters they specify to run,
and `magic-mode-alist', which determines modes based on file contents.")