Author: Philipp Stephani Date: 2022-02-23T17:00:12+01:00 New Revision: 2f906683ed14668ceed1f85922789abffd8429fd
URL: https://github.com/llvm/llvm-project/commit/2f906683ed14668ceed1f85922789abffd8429fd DIFF: https://github.com/llvm/llvm-project/commit/2f906683ed14668ceed1f85922789abffd8429fd.diff LOG: clang-format.el: Make clang-format work in indirect buffers. In an indirect buffer, buffer-file-name is nil, so check the base buffer instead. This works fine in direct buffers where buffer-base-buffer returns nil. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D120408 Added: Modified: clang/tools/clang-format/clang-format.el Removed: ################################################################################ diff --git a/clang/tools/clang-format/clang-format.el b/clang/tools/clang-format/clang-format.el index 768acb3a5d0dd..4e6daa82d4ade 100644 --- a/clang/tools/clang-format/clang-format.el +++ b/clang/tools/clang-format/clang-format.el @@ -147,7 +147,7 @@ uses the function `buffer-file-name'." (setq style clang-format-style)) (unless assume-file-name - (setq assume-file-name buffer-file-name)) + (setq assume-file-name (buffer-file-name (buffer-base-buffer)))) (let ((file-start (clang-format--bufferpos-to-filepos start 'approximate 'utf-8-unix)) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits