================ @@ -146,18 +146,125 @@ is a zero-based file offset, assuming ‘utf-8-unix’ coding." (lambda (byte &optional _quality _coding-system) (byte-to-position (1+ byte))))) -;;;###autoload -(defun clang-format-region (start end &optional style assume-file-name) - "Use clang-format to format the code between START and END according to STYLE. -If called interactively uses the region or the current statement if there is no -no active region. If no STYLE is given uses `clang-format-style'. Use -ASSUME-FILE-NAME to locate a style config file, if no ASSUME-FILE-NAME is given -uses the function `buffer-file-name'." - (interactive - (if (use-region-p) - (list (region-beginning) (region-end)) - (list (point) (point)))) +(defmacro clang-format--with-delete-files-guard (bind-files-to-delete &rest body) + "Execute BODY which may add temp files to BIND-FILES-TO-DELETE." + (declare (indent 1)) + `(let ((,bind-files-to-delete nil)) + (unwind-protect + (progn + ,@body) + (while ,bind-files-to-delete + (with-demoted-errors "failed to remove file: %S" + (delete-file (pop ,bind-files-to-delete))))))) + + +(defun clang-format--vc-diff-get-diff-lines (file-orig file-new) ---------------- ideasman42 wrote:
\*picky\* - personal preference, but I find it odd that the function returns command line arguments for clang-format. It can return a list of cons-pairs of instead `(list (cons int int) ...)` instead, then the clang-format function can convert them to the arguments used by clang-format. (the patch I attached did this). https://github.com/llvm/llvm-project/pull/112792 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits