.emacs file bits for automatically setting the llvm.org coding style. Thanks Anton.
authorMike Stump <mrs@apple.com>
Wed, 4 Mar 2009 14:14:37 +0000 (14:14 +0000)
committerMike Stump <mrs@apple.com>
Wed, 4 Mar 2009 14:14:37 +0000 (14:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66032 91177308-0d34-0410-b5e6-96231b3b80d8

utils/emacs/emacs.el

index 43e17a7be6ae8aa53a16aba0a4d1ebb957caa520..a12848b4575482c4e01cc8ff6ffdceb8a4a8cef9 100644 (file)
   '(c-basic-offset 2)
   '(indent-tabs-mode nil))
 
+
+;; Alternative to setting the global style.  Only files with "llvm" in
+;; their names will automatically set to the llvm.org coding style.
+(c-add-style "llvm.org"
+             '((fill-column . 80)
+              (c++-indent-level . 2)
+              (c-basic-offset . 2)
+              (indent-tabs-mode . nil)))
+(add-hook 'c-mode-hook
+         (function
+          (lambda nil 
+            (if (string-match "llvm" buffer-file-name)
+                (progn
+                  (c-set-style "llvm.org")
+                  )
+              ))))
+(add-hook 'c++-mode-hook
+         (function
+          (lambda nil 
+            (if (string-match "llvm" buffer-file-name)
+                (progn
+                  (c-set-style "llvm.org")
+                  )
+              ))))