[clang-tools-extra] r307635 - Use new command replace-buffer-contents if available

Philipp Stephani via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 02:01:58 PDT 2017


Author: phst
Date: Tue Jul 11 02:01:58 2017
New Revision: 307635

URL: http://llvm.org/viewvc/llvm-project?rev=307635&view=rev
Log:
Use new command replace-buffer-contents if available

Reviewers: klimek

Reviewed By: klimek

Differential Revision: https://reviews.llvm.org/D35211

Modified:
    clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el

Modified: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el?rev=307635&r1=307634&r2=307635&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el (original)
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el Tue Jul 11 02:01:58 2017
@@ -187,9 +187,9 @@ failure, a buffer containing the error o
   "Replace current buffer by content of STDOUT."
   (cl-check-type stdout buffer-live)
   (barf-if-buffer-read-only)
-  (unless (clang-include-fixer--insert-line stdout (current-buffer))
-    (erase-buffer)
-    (insert-buffer-substring stdout))
+  (cond ((fboundp 'replace-buffer-contents) (replace-buffer-contents stdout))
+        ((clang-include-fixer--insert-line stdout (current-buffer)))
+        (t (erase-buffer) (insert-buffer-substring stdout)))
   (message "Fix applied")
   nil)
 




More information about the cfe-commits mailing list