[PATCH] D69752: clang-format: Add a fallback style to Emacs mode

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 6 00:51:28 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf349cc37cc48: clang-format: Add a fallback style to Emacs mode (authored by MyDeveloperDay).

Changed prior to commit:
  https://reviews.llvm.org/D69752?vs=227584&id=228010#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69752/new/

https://reviews.llvm.org/D69752

Files:
  clang/tools/clang-format/clang-format.el


Index: clang/tools/clang-format/clang-format.el
===================================================================
--- clang/tools/clang-format/clang-format.el
+++ clang/tools/clang-format/clang-format.el
@@ -57,6 +57,18 @@
   :safe #'stringp)
 (make-variable-buffer-local 'clang-format-style)
 
+(defcustom clang-format-fallback-style "none"
+  "Fallback style to pass to clang-format.
+
+This style will be used if clang-format-style is set to \"file\"
+and no .clang-format is found in the directory of the buffer or
+one of parent directories. Set to \"none\" to disable formatting
+in such buffers."
+  :group 'clang-format
+  :type 'string
+  :safe #'stringp)
+(make-variable-buffer-local 'clang-format-fallback-style)
+
 (defun clang-format--extract (xml-node)
   "Extract replacements and cursor information from XML-NODE."
   (unless (and (listp xml-node) (eq (xml-node-name xml-node) 'replacements))
@@ -162,6 +174,7 @@
                                ,@(and assume-file-name
                                       (list "-assume-filename" assume-file-name))
                                ,@(and style (list "-style" style))
+                               "-fallback-style" ,clang-format-fallback-style
                                "-offset" ,(number-to-string file-start)
                                "-length" ,(number-to-string (- file-end file-start))
                                "-cursor" ,(number-to-string cursor))))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69752.228010.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191106/ebce33ee/attachment.bin>


More information about the cfe-commits mailing list