File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -121,17 +121,12 @@ Return black process the exit code."
121
121
(list " --pyi" ))
122
122
'(" -" )))
123
123
124
- (defun blacken-regex-in-file (regex file )
125
- " Reads a file and returns a list of lines in that file"
126
- (with-temp-buffer
127
- (insert-file-contents file)
128
- (re-search-forward regex nil t 1 )))
129
-
130
124
(defun blacken-project-is-blackened (&optional display )
131
125
" Whether the project has a pyproject.toml with [tool.black] in it."
132
- (let ((parent (locate-dominating-file default-directory " pyproject.toml" )))
133
- (and parent
134
- (blacken-regex-in-file " ^\\ [tool.black\\ ]$" (concat parent " pyproject.toml" )))))
126
+ (when-let ((parent (locate-dominating-file default-directory " pyproject.toml" )))
127
+ (with-temp-buffer
128
+ (insert-file-contents (concat parent " pyproject.toml" ))
129
+ (re-search-forward " ^\\ [tool.black\\ ]$" nil t 1 ))))
135
130
136
131
;;;### autoload
137
132
(defun blacken-buffer (&optional display )
You can’t perform that action at this time.
0 commit comments