File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 38
38
; ;
39
39
; ;; Code:
40
40
41
+ (require 'cl-lib )
42
+
41
43
42
44
(defgroup blacken nil
43
45
" Reformat Python code with \" black\" ."
48
50
:type 'string )
49
51
50
52
(defcustom blacken-line-length nil
51
- " Line length to enforce."
52
- :type 'number
53
- :safe 'numberp )
53
+ " Line length to enforce.
54
+
55
+ It must be an integer, nil or `fill' .
56
+ If `fill' , the `fill-column' variable value is used."
57
+ :type '(choice :tag " Line Length Limit"
58
+ (const :tag " Use default" nil )
59
+ (const :tag " Use fill-column" fill)
60
+ (integer :tag " Line Length" ))
61
+ :safe 'integerp )
54
62
55
63
(defcustom blacken-allow-py36 nil
56
64
" Allow using Python 3.6-only syntax on all input files."
@@ -95,7 +103,10 @@ Return black process the exit code."
95
103
" Build black process call arguments."
96
104
(append
97
105
(when blacken-line-length
98
- (list " --line-length" (number-to-string blacken-line-length)))
106
+ (list " --line-length"
107
+ (number-to-string (cl-case blacken-line-length
108
+ ('fill fill-column)
109
+ (t blacken-line-length)))))
99
110
(when blacken-allow-py36
100
111
(list " --py36" ))
101
112
(when blacken-fast-unsafe
You can’t perform that action at this time.
0 commit comments