276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
-
+
-
-
-
-
+
|
(erase-buffer)
(setq header-line-format
(format "Thread %d: %s" id
(cdr (assq 'headline thread))))
(dolist (post (cadr (assq 'posts thread)))
(sbbs--thread-insert-post post))
(delete-blank-lines)
(goto-char (point-min)))
(goto-char (point-min)))))))
(rename-buffer (format "*reading /%s/%d*"
(sbbs--board-name sbbs--board)
id))))))
;; INTERACTIVE FUNCTIONS
(defun sbbs-view-open (id)
"Open thread ID in new buffer."
(interactive (list (tabulated-list-get-id)))
(let ((url (sbbs--board-url (format "/%d" id) t))
(headline (or (and (not (tabulated-list-get-entry))
header-line-format)
(substring-no-properties
(aref (tabulated-list-get-entry) 2))))
(board sbbs--board)
(buf (get-buffer-create
(format "*loading /%s/%d*"
(format "*reading /%s/%d*"
(sbbs--board-name sbbs--board)
id))))
(with-current-buffer buf
(sbbs-read-mode)
(when headline
(setq header-line-format (format "Thread %d: %s" id headline)))
(setq sbbs--board board
|