From 2f906683ed14668ceed1f85922789abffd8429fd Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Wed, 23 Feb 2022 17:00:04 +0100 Subject: [PATCH] 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 --- clang/tools/clang-format/clang-format.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/tools/clang-format/clang-format.el b/clang/tools/clang-format/clang-format.el index 768acb3..4e6daa8 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)) -- 2.7.4