From 6ea190f42924f74736fe21ec5bd38df105e39562 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 18 Apr 2019 17:49:08 +0200 Subject: [PATCH] add clang-format to emacs configuration (still requires clang-format to be installed globally first) --- .dir-locals.el | 3 +++ .gitignore | 1 + bootstrap | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.dir-locals.el b/.dir-locals.el index 687863811..29999b944 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,5 +1,8 @@ ;; Per-directory local variables for GNU Emacs 23 and later. +((c-mode + (eval add-hook 'before-save-hook #'clang-format-buffer nil t))) + ((nil . ((fill-column . 78) (tab-width . 4) diff --git a/.gitignore b/.gitignore index 31cfa5897..e898f41f8 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ *.swp *.trs *.kdev4 +.clang-format .deps/ .libs/ .svn/ diff --git a/bootstrap b/bootstrap index 9d9d97b1d..c87f375ea 100755 --- a/bootstrap +++ b/bootstrap @@ -3,6 +3,9 @@ echo "Removing folder 'libltdl'..." rm -rf libltdl +# Install clang format symlink (if possible) +ln -s contrib/conf/editors/clang-format .clang-format &> /dev/null + echo "checking for libtoolize / libtool... " # This is more portable than `which' but comes with -- 2.25.1