1;;===-- docs/flang-c-style.el ------------------------------------===;; 2;; 3;; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4;; See https://llvm.org/LICENSE.txt for license information. 5;; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6;; 7;;===----------------------------------------------------------------------===;; 8 9;; Define a cc-mode style for editing C++ codes in Flang. 10;; 11;; Inspired from LLVM style in 12;; https://github.com/llvm-mirror/llvm/blob/master/utils/emacs/emacs.el 13;; 14 15(c-add-style "flang" 16 '("gnu" 17 (fill-column . 80) 18 (c++-indent-level . 2) 19 (c-basic-offset . 2) 20 (indent-tabs-mode . nil) 21 (c-offsets-alist . 22 ((arglist-intro . ++) 23 (innamespace . 0) 24 (member-init-intro . ++) 25 )) 26 )) 27 28 29;; 30;; Use the following to make it the default. 31;; 32 33(defun flang-c-mode-hook () 34 (c-set-style "flang") 35 ) 36 37(add-hook 'c-mode-hook 'flang-c-mode-hook) 38(add-hook 'c++-mode-hook 'flang-c-mode-hook) 39