- (let ((objc (derived-mode-p 'objc-mode)))
- (with-temp-buffer
- (let ((res (apply 'call-process company-clang-executable nil t nil args)))
- (unless (eq 0 res)
- (company-clang--handle-error res args))
- ;; Still try to get any useful input.
- (company-clang--parse-output prefix objc)))))
+ (let ((objc (derived-mode-p 'objc-mode))
+ (buf (get-buffer-create "*clang-output*"))
+ res)
+ (with-current-buffer buf (erase-buffer))
+ (setq res (if (company-clang--auto-save-p)
+ (apply 'call-process company-clang-executable nil buf nil args)
+ (apply 'call-process-region (point-min) (point-max)
+ company-clang-executable nil buf nil args)))
+ (with-current-buffer buf
+ (unless (eq 0 res)
+ (company-clang--handle-error res args))
+ ;; Still try to get any useful input.
+ (company-clang--parse-output prefix objc))))