@@ -49,6 +49,13 @@ A string containing the name or the full path of the executable."
49
49
:type '(file :must-match t :match (lambda (widget file ) (file-executable-p file)))
50
50
:risky t )
51
51
52
+ (defcustom google-java-format-arguments
53
+ '()
54
+ " Arguments to pass into google-java-format-executable"
55
+ :group 'google-java-format
56
+ :type '(repeat string)
57
+ :risky t )
58
+
52
59
;;;### autoload
53
60
(defun google-java-format-region (start end )
54
61
" Use google-java-format to format the code between START and END.
@@ -62,16 +69,17 @@ there is no region, then formats the current line."
62
69
(temp-buffer (generate-new-buffer " *google-java-format-temp*" ))
63
70
(stderr-file (make-temp-file " google-java-format" )))
64
71
(unwind-protect
65
- (let ((status (call-process-region
66
- ; ; Note that emacs character positions are 1-indexed,
67
- ; ; and google-java-format is 0-indexed, so we have to
68
- ; ; subtract 1 from START to line it up correctly.
69
- (point-min ) (point-max )
70
- google-java-format-executable
71
- nil (list temp-buffer stderr-file) t
72
- " --offset" (number-to-string (1- start))
73
- " --length" (number-to-string (- end start))
74
- " -" ))
72
+ (let ((status (apply #'call-process-region
73
+ ; ; Note that emacs character positions are 1-indexed,
74
+ ; ; and google-java-format is 0-indexed, so we have to
75
+ ; ; subtract 1 from START to line it up correctly.
76
+ (point-min ) (point-max )
77
+ google-java-format-executable
78
+ nil (list temp-buffer stderr-file) t
79
+ (append google-java-format-arguments
80
+ `(" --offset" ,(number-to-string (1- start))
81
+ " --length" ,(number-to-string (- end start))
82
+ " -" ))))
75
83
(stderr
76
84
(with-temp-buffer
77
85
(insert-file-contents stderr-file)
0 commit comments