sbbs.el

Check-in [67d30a2317]
Login
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: 67d30a23170591c903b775fb7124e10475f2812d1291017d3bb1504ef6fdbd2f
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
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

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  +  (unwind-protect
   449    450     (when (buffer-live-p buf)
   450    451       (when (plist-get status :error)
   451    452         (error "Error while loading: %s"
   452    453                (cdr (plist-get status :error))))
   453    454       (forward-paragraph)
   454    455       (sbbs--fix-encoding)
   455    456       (let ((list (read (current-buffer))))
   456         -      (kill-buffer)
   457    457         (with-current-buffer buf
   458    458           (let (ent)
   459    459             (dolist (thread list)
   460    460               (push (list (car thread)
   461    461                           (vector (substring (cdr (assq 'date (cdr thread)))
   462    462                                              0 16)
   463    463                                   (number-to-string
................................................................................
   464    464                                    (cdr (assq 'messages (cdr thread))))
   465    465                                   (propertize
   466    466                                    (cdr (assq 'headline (cdr thread)))
   467    467                                    'face 'sbbs--variable-pitch)))
   468    468                     ent))
   469    469             (setq-local tabulated-list-entries ent)
   470    470             (tabulated-list-print t t)
   471         -          (hl-line-highlight))))))
          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."
          479  +  (unwind-protect
   478    480     (when (buffer-live-p buf)
   479    481       (when (plist-get status :error)
   480    482         (error "Error while loading: %s"
   481    483                (cdr (plist-get status :error))))
   482    484       (prog-mode)
   483    485       (forward-paragraph)
   484    486       (sbbs--fix-encoding)
................................................................................
   489    491               (replace-match "nil")))))
   490    492       (save-excursion
   491    493         (save-match-data
   492    494           (while (search-forward "#f" nil t)
   493    495             (unless (cadddr (syntax-ppss))
   494    496               (replace-match "t")))))
   495    497       (let ((thread (read (current-buffer))))
   496         -      (kill-buffer)
   497    498         (with-current-buffer buf
   498    499           (let ((buffer-read-only nil))
   499    500             (erase-buffer)
   500    501             (setq header-line-format
   501    502                   (format "Thread %d: %s" id
   502    503                           (cdr (assq 'headline thread))))
   503    504             (dolist (post (cadr (assq 'posts thread)))
   504    505               (sbbs--thread-insert-post post))
   505    506             (delete-blank-lines)
   506    507             (when range
   507    508               (sbbs--limit-to-range range))
   508    509             (if sbbs-open-at-last-post
   509    510                 (sbbs-goto-end)
   510         -            (goto-char (point-min))))))))
          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)