@@ -249,9 +249,9 @@ (setq-local tabulated-list-entries ent) (tabulated-list-print t t) (hl-line-highlight)))))) -(defun sbbs--thread-loader (status board id buf) +(defun sbbs--thread-loader (status id buf) "Callback function for `url-retrieve' when loading thread. The attribute ID determines what thread from board BOARD to load. STATUS is used to check for errors." @@ -273,11 +273,8 @@ (replace-match "t"))))) (let ((thread (read (current-buffer)))) (kill-buffer) (with-current-buffer buf - (sbbs-read-mode) - (setq sbbs--board board - sbbs--thread-id id) (let ((buffer-read-only nil)) (erase-buffer) (setq header-line-format (format "Thread %d: %s" id @@ -286,9 +283,9 @@ (sbbs--thread-insert-post post)) (delete-blank-lines) (goto-char (point-min))) (rename-buffer (format "*reading /%s/%d*" - (sbbs--board-name board) + (sbbs--board-name sbbs--board) id)))))) ;; INTERACTIVE FUNCTIONS @@ -297,16 +294,19 @@ (interactive (list (tabulated-list-get-id))) (let ((url (sbbs--board-url (format "/%d" id) t)) (headline (substring-no-properties (aref (tabulated-list-get-entry ) 2))) + (board sbbs--board) (buf (get-buffer-create (format "*loading /%s/%d*" (sbbs--board-name sbbs--board) id)))) - (url-retrieve url #'sbbs--thread-loader - (list sbbs--board id buf)) (with-current-buffer buf - (setq header-line-format (format "Thread %d: %s" id headline))) + (sbbs-read-mode) + (setq header-line-format (format "Thread %d: %s" id headline) + sbbs--board board + sbbs--thread-id id)) + (url-retrieve url #'sbbs--thread-loader (list id buf)) (switch-to-buffer buf))) (defun sbbs-view-compose () "Create buffer to start a new thread."