Overview
Comment: | Always kill HTTP response buffer after processing it |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
67d30a23170591c903b775fb7124e104 |
User & Date: | zge on 2022-01-22 18:49:52 |
Other Links: | branch diff | manifest | tags |
Context
2022-01-22
| ||
18:57 | Kill thread buffers when quitting board buffer check-in: a3e4eb41e0 user: zge tags: master, trunk | |
18:49 | Always kill HTTP response buffer after processing it check-in: 67d30a2317 user: zge tags: master, trunk | |
18:27 | Add support for VIP-posting check-in: 46949449f3 user: zge tags: master, trunk | |
Changes
Modified sbbs.el from [a4c9b26bff] to [1c7c7f43da].
442 442 'utf-8)) 443 443 444 444 (defun sbbs--board-loader (status buf) 445 445 "Callback function for `url-retrieve' when loading board. 446 446 447 447 Load results into buffer BUF. STATUS is used to check for 448 448 errors." 449 - (when (buffer-live-p buf) 450 - (when (plist-get status :error) 451 - (error "Error while loading: %s" 452 - (cdr (plist-get status :error)))) 453 - (forward-paragraph) 454 - (sbbs--fix-encoding) 455 - (let ((list (read (current-buffer)))) 456 - (kill-buffer) 457 - (with-current-buffer buf 458 - (let (ent) 459 - (dolist (thread list) 460 - (push (list (car thread) 461 - (vector (substring (cdr (assq 'date (cdr thread))) 462 - 0 16) 463 - (number-to-string 464 - (cdr (assq 'messages (cdr thread)))) 465 - (propertize 466 - (cdr (assq 'headline (cdr thread))) 467 - 'face 'sbbs--variable-pitch))) 468 - ent)) 469 - (setq-local tabulated-list-entries ent) 470 - (tabulated-list-print t t) 471 - (hl-line-highlight)))))) 449 + (unwind-protect 450 + (when (buffer-live-p buf) 451 + (when (plist-get status :error) 452 + (error "Error while loading: %s" 453 + (cdr (plist-get status :error)))) 454 + (forward-paragraph) 455 + (sbbs--fix-encoding) 456 + (let ((list (read (current-buffer)))) 457 + (with-current-buffer buf 458 + (let (ent) 459 + (dolist (thread list) 460 + (push (list (car thread) 461 + (vector (substring (cdr (assq 'date (cdr thread))) 462 + 0 16) 463 + (number-to-string 464 + (cdr (assq 'messages (cdr thread)))) 465 + (propertize 466 + (cdr (assq 'headline (cdr thread))) 467 + 'face 'sbbs--variable-pitch))) 468 + ent)) 469 + (setq-local tabulated-list-entries ent) 470 + (tabulated-list-print t t) 471 + (hl-line-highlight))))) 472 + (kill-buffer))) 472 473 473 474 (defun sbbs--thread-loader (status id buf range) 474 475 "Callback function for `url-retrieve' when loading thread. 475 476 476 477 The attribute ID determines what thread from board BOARD to 477 478 load. STATUS is used to check for errors." 478 - (when (buffer-live-p buf) 479 - (when (plist-get status :error) 480 - (error "Error while loading: %s" 481 - (cdr (plist-get status :error)))) 482 - (prog-mode) 483 - (forward-paragraph) 484 - (sbbs--fix-encoding) 485 - (save-excursion 486 - (save-match-data 487 - (while (search-forward "#f" nil t) 488 - (unless (cadddr (syntax-ppss)) 489 - (replace-match "nil"))))) 490 - (save-excursion 491 - (save-match-data 492 - (while (search-forward "#f" nil t) 493 - (unless (cadddr (syntax-ppss)) 494 - (replace-match "t"))))) 495 - (let ((thread (read (current-buffer)))) 496 - (kill-buffer) 497 - (with-current-buffer buf 498 - (let ((buffer-read-only nil)) 499 - (erase-buffer) 500 - (setq header-line-format 501 - (format "Thread %d: %s" id 502 - (cdr (assq 'headline thread)))) 503 - (dolist (post (cadr (assq 'posts thread))) 504 - (sbbs--thread-insert-post post)) 505 - (delete-blank-lines) 506 - (when range 507 - (sbbs--limit-to-range range)) 508 - (if sbbs-open-at-last-post 509 - (sbbs-goto-end) 510 - (goto-char (point-min)))))))) 479 + (unwind-protect 480 + (when (buffer-live-p buf) 481 + (when (plist-get status :error) 482 + (error "Error while loading: %s" 483 + (cdr (plist-get status :error)))) 484 + (prog-mode) 485 + (forward-paragraph) 486 + (sbbs--fix-encoding) 487 + (save-excursion 488 + (save-match-data 489 + (while (search-forward "#f" nil t) 490 + (unless (cadddr (syntax-ppss)) 491 + (replace-match "nil"))))) 492 + (save-excursion 493 + (save-match-data 494 + (while (search-forward "#f" nil t) 495 + (unless (cadddr (syntax-ppss)) 496 + (replace-match "t"))))) 497 + (let ((thread (read (current-buffer)))) 498 + (with-current-buffer buf 499 + (let ((buffer-read-only nil)) 500 + (erase-buffer) 501 + (setq header-line-format 502 + (format "Thread %d: %s" id 503 + (cdr (assq 'headline thread)))) 504 + (dolist (post (cadr (assq 'posts thread))) 505 + (sbbs--thread-insert-post post)) 506 + (delete-blank-lines) 507 + (when range 508 + (sbbs--limit-to-range range)) 509 + (if sbbs-open-at-last-post 510 + (sbbs-goto-end) 511 + (goto-char (point-min))))))) 512 + (kill-buffer))) 511 513 512 514 513 515 ;;; INTERACTIVE FUNCTIONS 514 516 515 517 (defun sbbs-open-externally () 516 518 "Open the current thread using `browse-url'." 517 519 (interactive)