Code Monkey home page Code Monkey logo

clang-format's Introduction

clang-format.el

Clang-format emacs integration for use with C/Objective-C/C++.
https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.el

Update

  • Add provide statement
    Add support for requrire statement. Now available (require 'clang-format) on init.el.

  • Avoid empty buffer when executing clang-format-xxx without clang-format-binary
    If clang-format is not installed, print error message on mini buffer.

  • Add configuration about clang-format style option
    LLVM(default), Google, Chromium, Mozilla, WebKit, file(read from .clang-format), '{key1:value1, key2:valu2, ...}' .
    See http://clang.llvm.org/docs/ClangFormat.html, http://clang.llvm.org/docs/ClangFormatStyleOptions.html

Usage

init.el

(require 'clang-format)
(global-set-key (kbd "C-c i") 'clang-format-region)
(global-set-key (kbd "C-c u") 'clang-format-buffer)

(setq clang-format-style-option "llvm")

clang-format's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

clang-format's Issues

Error message

clang-format: (clang-format failed with code 1: error: offset 963 is outside the file)
 clang-format -version
clang-format version 6.0.0 (tags/RELEASE_600/final)
GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8) of 2016-10-25
  clang-format       20180406.1514 installed             Format code using clang-format

On windows 10, clang-format.el is not obeying .clang-format but it follows _clang-format file from the project Repository.

So I have this is my init.el

    (use-package clang-format
      :init
      (global-set-key (kbd "C-c r") 'clang-format-region)
      (global-set-key (kbd "C-c u") 'clang-format-buffer)
      :config
      (setq clang-format-style-option "file")
      )

And this in my .clang-format

    BasedOnStyle: Google
    Language: Cpp
    Standard: Cpp11
    Cpp11BracedListStyle: true
    IndentWidth: 4
    ColumnLimit: 100
    BreakBeforeBraces: Linux
    AlignAfterOpenBracket: Align
    AlignConsecutiveAssignments: true
    AlignOperands: true
    AllowShortFunctionsOnASingleLine: Empty
    DerivePointerAlignment: false
    PointerAlignment: Left

If I make a _clang-format in any Repository or project directory, then clang-format obeys that file, but It never follows .clang-format file from my home directory , any reason why ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.