sbbs.el

Check-in [5fba0a20a4]
Login
Overview
Comment:enable sbbs-read-mode before fetching thread contents
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 5fba0a20a46c6aacb8ed36d3a6b4d6b94e4ba3337e967425591a38dee3336380
User & Date: philip@warpmail.net on 2020-02-26 15:23:13
Other Links: branch diff | manifest | tags
Context
2020-02-26
22:17
removed risky flag from sbbs-boards check-in: 9ba0256b5c user: philip@warpmail.net tags: master, trunk
15:23
enable sbbs-read-mode before fetching thread contents check-in: 5fba0a20a4 user: philip@warpmail.net tags: master, trunk
2020-02-24
16:19
removed sbbs--ornamentum variable check-in: 06efb04e61 user: philip@warpmail.net tags: master, trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified sbbs.el from [637706a84f] to [aca41172ba].

   246    246                                    (cdr (assq 'headline (cdr thread)))
   247    247                                    'face 'variable-pitch)))
   248    248                     ent))
   249    249             (setq-local tabulated-list-entries ent)
   250    250             (tabulated-list-print t t)
   251    251             (hl-line-highlight))))))
   252    252   
   253         -(defun sbbs--thread-loader (status board id buf)
          253  +(defun sbbs--thread-loader (status id buf)
   254    254     "Callback function for `url-retrieve' when loading thread.
   255    255   
   256    256   The attribute ID determines what thread from board BOARD to
   257    257   load. STATUS is used to check for errors."
   258    258     (when (buffer-live-p buf)
   259    259       (when (plist-get status :error)
   260    260         (error "Error while loading: %s"
................................................................................
   270    270         (save-match-data
   271    271           (while (search-forward "#f" nil t)
   272    272             (unless (cadddr (syntax-ppss))
   273    273               (replace-match "t")))))
   274    274       (let ((thread (read (current-buffer))))
   275    275         (kill-buffer)
   276    276         (with-current-buffer buf
   277         -        (sbbs-read-mode)
   278         -        (setq sbbs--board board
   279         -              sbbs--thread-id id)
   280    277           (let ((buffer-read-only nil))
   281    278             (erase-buffer)
   282    279             (setq header-line-format
   283    280                   (format "Thread %d: %s" id
   284    281                           (cdr (assq 'headline thread))))
   285    282             (dolist (post (cadr (assq 'posts thread)))
   286    283               (sbbs--thread-insert-post post))
   287    284             (delete-blank-lines)
   288    285             (goto-char (point-min)))
   289    286           (rename-buffer (format "*reading /%s/%d*"
   290         -                               (sbbs--board-name board)
          287  +                               (sbbs--board-name sbbs--board)
   291    288                                  id))))))
   292    289   
   293    290    ;; INTERACTIVE FUNCTIONS
   294    291   
   295    292   (defun sbbs-view-open (id)
   296    293     "Open thread ID in new buffer."
   297    294     (interactive (list (tabulated-list-get-id)))
   298    295     (let ((url (sbbs--board-url (format "/%d" id) t))
   299    296           (headline (substring-no-properties
   300    297                      (aref (tabulated-list-get-entry ) 2)))
          298  +        (board sbbs--board)
   301    299           (buf (get-buffer-create
   302    300                 (format "*loading /%s/%d*"
   303    301                         (sbbs--board-name sbbs--board)
   304    302                         id))))
   305         -    (url-retrieve url #'sbbs--thread-loader
   306         -                  (list sbbs--board id buf))
   307    303       (with-current-buffer buf
   308         -      (setq header-line-format (format "Thread %d: %s" id headline)))
          304  +      (sbbs-read-mode)
          305  +      (setq header-line-format (format "Thread %d: %s" id headline)
          306  +            sbbs--board board
          307  +            sbbs--thread-id id))
          308  +    (url-retrieve url #'sbbs--thread-loader (list id buf))
   309    309       (switch-to-buffer buf)))
   310    310   
   311    311   (defun sbbs-view-compose ()
   312    312     "Create buffer to start a new thread."
   313    313     (interactive)
   314    314     (let ((board sbbs--board))
   315    315       (with-current-buffer (generate-new-buffer "*new thread*")