Skip to content

Commit 2f90668

Browse files
phstsam-mccall
authored andcommitted
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
1 parent 9f1c6fb commit 2f90668

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/tools/clang-format/clang-format.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ uses the function `buffer-file-name'."
147147
(setq style clang-format-style))
148148

149149
(unless assume-file-name
150-
(setq assume-file-name buffer-file-name))
150+
(setq assume-file-name (buffer-file-name (buffer-base-buffer))))
151151

152152
(let ((file-start (clang-format--bufferpos-to-filepos start 'approximate
153153
'utf-8-unix))

0 commit comments

Comments
 (0)