phst created this revision. phst added a reviewer: sammccall. phst requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D120408 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 @@ -147,7 +147,7 @@ (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))
Index: clang/tools/clang-format/clang-format.el =================================================================== --- clang/tools/clang-format/clang-format.el +++ clang/tools/clang-format/clang-format.el @@ -147,7 +147,7 @@ (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