Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/emacs-php/magic-filetype.el

Enhance filetype major mode
https://github.com/emacs-php/magic-filetype.el

Last synced: about 1 month ago
JSON representation

Enhance filetype major mode

Awesome Lists containing this project

README

        

* magic-filetype
#+BEGIN_HTML
MELPA magic-filetype
MELPA stable: magic-filetype
Join the chat at https://gitter.im/zonuexe/magic-filetype.el
#+END_HTML

Enhance filetype major mode

** Installation
*** Cask
See [[http://cask.readthedocs.org/en/latest/guide/installation.html][Cask Installation]]. put into your own =Cask= file.
*** MELPA
See [[http://melpa.org/#/getting-started][Getting Started - MELPA]]. =M-x package-install= and type =magic-filetype=.
*** El-get
See [[https://github.com/dimitri/el-get#installation][El-Get #Installation]]. put into your own =init.el= file.
#+BEGIN_SRC emacs-lisp
(el-get-bundle magic-filetype)
#+END_SRC

** Features

*** Support Vim-style file type header
put into your own =.emacs= file (=init.el=)
#+BEGIN_SRC emacs-lisp
(magic-filetype-enable-vim-filetype)
#+END_SRC

*** Major mode settings
for example...
#+BEGIN_SRC emacs-lisp
(add-to-list 'auto-mode-alist `("/.fooconfig\\'" . ,(magic-filetype-major-mode-of 'javascript)))
(add-to-list 'auto-mode-alist `("/FooPack.lock\\'" . ,(magic-filetype-major-mode-of 'json)))
#+END_SRC

If you write the setting to =.emacs=, you can be briefly defined as follows.
#+BEGIN_SRC emacs-lisp
(defalias 'major-mode-of 'magic-filetype-major-mode-of)

(add-to-list 'auto-mode-alist `("/\\.mysql\\'" . ,(major-mode-of 'mysql)))
#+END_SRC

*** Use major mode from language name
=M-x magic-filetype-major-mode-from-language-name=

*** Reload major mode
=M-x magic-filetype-reload-major-mode=

** Utility function
*** Collect major-modes
#+BEGIN_SRC emacs-lisp
(require 'magic-filetype')
(completing-read "Input major mode: " (magic-filetype-collect-major-modes))
#+END_SRC