[llvm-commits] [llvm] r66032 - /llvm/trunk/utils/emacs/emacs.el

Mike Stump mrs at apple.com
Wed Mar 4 06:14:42 PST 2009


Author: mrs
Date: Wed Mar  4 08:14:37 2009
New Revision: 66032

URL: http://llvm.org/viewvc/llvm-project?rev=66032&view=rev
Log:
.emacs file bits for automatically setting the llvm.org coding style.  Thanks Anton.

Modified:
    llvm/trunk/utils/emacs/emacs.el

Modified: llvm/trunk/utils/emacs/emacs.el
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/emacs.el?rev=66032&r1=66031&r2=66032&view=diff

==============================================================================
--- llvm/trunk/utils/emacs/emacs.el (original)
+++ llvm/trunk/utils/emacs/emacs.el Wed Mar  4 08:14:37 2009
@@ -10,3 +10,27 @@
   '(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")
+		   )
+	       ))))





More information about the llvm-commits mailing list