[LLVMdev] Emacs LLVM coding style dir-locals (original) (raw)

Stephen Crane sjcrane at uci.edu
Mon Oct 6 16:59:49 PDT 2014


Hi all,

Just wanted to share a trick I found for using the LLVM coding style in Emacs, although I'm sure this is nothing new to veterans around here. There's an LLVM coding style emacs plugin in /utils/emacs/emacs.el. However this uses a string match against "llvm" to try to guess if the current directory contains llvm sources. A simpler method is to use Emacs directory variable support ( https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html). Just drop the following lines into a .dir-locals.el file in the root of the LLVM sources, and all files in the source tree will pick up the correct formatting settings:

((nil . ((indent-tabs-mode . nil) (fill-column . 80) (c++-indent-level . 2) (c-base-offset . 2) (c-offsets-alist . ((innamespace . 0))))))

I hope this helps someone!



More information about the llvm-dev mailing list