@@ -154,27 +154,26 @@ Use `helm-qiita-url' if URL is nil."
154
154
" --header" ,(concat " Authorization: Bearer " helm-qiita-access-token)
155
155
,(if url url helm-qiita-url)))
156
156
proc)
157
- (unless (get-buffer-process http-buffer-name)
158
- (if (get-buffer http-buffer-name)
159
- (kill-buffer http-buffer-name))
160
- (unless url ; ; 1st page
161
- (if (get-buffer work-buffer-name)
162
- (kill-buffer work-buffer-name))
163
- (get-buffer-create work-buffer-name))
164
- (helm-qiita-http-debug-start)
165
- (setq proc (apply 'start-process
166
- proc-name
167
- http-buffer-name
168
- helm-qiita-curl-program
169
- curl-args))
170
- (set-process-sentinel proc 'helm-qiita-http-request-sentinel ))))
157
+ (unless url ; ; 1st page
158
+ (if (get-buffer work-buffer-name)
159
+ (kill-buffer work-buffer-name))
160
+ (get-buffer-create work-buffer-name))
161
+ (helm-qiita-http-debug-start)
162
+ (setq proc (apply 'start-process
163
+ proc-name
164
+ http-buffer-name
165
+ helm-qiita-curl-program
166
+ curl-args))
167
+ (set-process-sentinel proc 'helm-qiita-http-request-sentinel )))
171
168
172
169
(defun helm-qiita-http-request-sentinel (process _event )
173
170
" Receive a response of `helm-qiita-http-request' .
174
171
PROCESS is a http-request process.
175
172
_EVENT is a string describing the type of event."
176
- (ignore-errors
177
- (helm-qiita-handle-http-response process)))
173
+ (condition-case nil
174
+ (helm-qiita-handle-http-response process)
175
+ (error
176
+ (kill-buffer helm-qiita-http-buffer-name))))
178
177
179
178
(defun helm-qiita-handle-http-response (process )
180
179
" Handle a response of `helm-qiita-http-request' .
@@ -189,14 +188,15 @@ If next-link is exist, continue to request it."
189
188
(setq response (json-read-from-string
190
189
(buffer-substring-no-properties
191
190
(+ (helm-qiita-point-of-separator) 1 ) (point-max )))))
191
+ (kill-buffer helm-qiita-http-buffer-name)
192
192
(with-current-buffer (get-buffer helm-qiita-work-buffer-name)
193
193
(goto-char (point-max ))
194
194
(dotimes (i (length response))
195
- (setq stock (aref response i))
196
- (insert (format " %s %s [href:%s ]\n "
197
- (helm-qiita-stock-title stock)
198
- (helm-qiita-stock-format-tags stock)
199
- (helm-qiita-stock-url stock))))
195
+ (setq stock (aref response i))
196
+ (insert (format " %s %s [href:%s ]\n "
197
+ (helm-qiita-stock-title stock)
198
+ (helm-qiita-stock-format-tags stock)
199
+ (helm-qiita-stock-url stock))))
200
200
(if next-link
201
201
(helm-qiita-http-request next-link)
202
202
(write-region (point-min ) (point-max ) helm-qiita-file)))))
0 commit comments