[PATCH] D37903: Fix assume-filename handling in clang-format.el
Micah Werbitt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 19 05:11:30 PDT 2017
werbitt updated this revision to Diff 115827.
werbitt added a comment.
Clean up call-process-region
- Quote call-process-region with #', this will cause a compile time error if call-process-region is undefined
- Pass positional arguments normally (exclude from the list)
- Instead of using append use a backquoted list
- Use ,@ to splice the assume file logic into the list
- Use 'and' instead of 'if'
https://reviews.llvm.org/D37903
Files:
tools/clang-format/clang-format.el
Index: tools/clang-format/clang-format.el
===================================================================
--- tools/clang-format/clang-format.el
+++ tools/clang-format/clang-format.el
@@ -147,16 +147,15 @@
;; always use ‘utf-8-unix’ and ignore the buffer coding system.
(default-process-coding-system '(utf-8-unix . utf-8-unix)))
(unwind-protect
- (let ((status (apply 'call-process-region
- (append `(nil nil ,clang-format-executable
- nil (,temp-buffer ,temp-file) nil)
- '("-output-replacements-xml")
- (if assume-file
- `("-assume-filename" ,assume-file) nil)
- `("-style" ,style
- "-offset" ,(number-to-string file-start)
- "-length" ,(number-to-string (- file-end file-start))
- "-cursor" ,(number-to-string cursor)))))
+ (let ((status (apply #'call-process-region
+ nil nil clang-format-executable
+ nil `(,temp-buffer ,temp-file) nil
+ `("-output-replacements-xml"
+ ,@(and assume-file (list "-assume-filename" assume-file))
+ "-style" ,style
+ "-offset" ,(number-to-string file-start)
+ "-length" ,(number-to-string (- file-end file-start))
+ "-cursor" ,(number-to-string cursor))))
(stderr (with-temp-buffer
(unless (zerop (cadr (insert-file-contents temp-file)))
(insert ": "))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37903.115827.patch
Type: text/x-patch
Size: 1867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170919/3b88ef7a/attachment.bin>
More information about the cfe-commits
mailing list