sbbs.el

Check-in [93975f9b0f]
Login
Overview
Comment:fixed checkdoc complaints
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 93975f9b0f46ef4aadfadf5e085660cb59381f17783f4bef7e0583f8493d1d56
User & Date: philip@warpmail.net on 2020-02-22 09:52:54
Other Links: branch diff | manifest | tags
Context
2020-02-22
13:16
show buffer when created instead of when ready check-in: 9d4d483630 user: philip@warpmail.net tags: master, trunk
09:52
fixed checkdoc complaints check-in: 93975f9b0f user: philip@warpmail.net tags: master, trunk
2020-02-21
23:09
added more issues and improvments to readme check-in: 3010b30422 user: philip@warpmail.net tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified sbbs.el from [7a0569766c] to [e250c11b65].

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
224
225
226
227
228
229
230
231

232
233
234
235
236
237
238
...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
...
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
           (let* ((text (caddr it))
                  (link (plist-get (cadadr it) 'href)))
             (sbbs--insert-link text link)))
          (t (insert (prin1-to-string it)))))
  (insert ?\n))

(defun sbbs--insert-sxml (sxml)
  "Insert top-level SXML into buffer at point."
  (dolist (par sxml)
    (cond ((eq (car par) 'p)
           (sbbs--insert-sxml-par (cdr par)))
          ((eq (car par) 'blockquote)
           (let ((start (point))
                 (comment-start "> "))
             (sbbs--insert-sxml-par (cdadr par))
................................................................................
    (add-text-properties start (point) (list 'sbbs-thread-nr (car post)))))

  ;; URL.EL CALLBACKS

(defun sbbs--board-loader (status buf)
  "Callback function for `url-retrieve' when loading board.

Load results into buffer BUF."

  (when (plist-get status :error)
    (message "Error while loading: %s"
             (cdr (plist-get status :error))))
  (forward-paragraph)
  (let ((list (read (current-buffer))))
    (kill-buffer)
    (with-current-buffer buf
................................................................................
    (switch-to-buffer buf)
    (hl-line-highlight)))

(defun sbbs--thread-loader (status board id)
  "Callback function for `url-retrieve' when loading thread.

The attribute ID determines what thread from board BOARD to
load."
  (when (plist-get status :error)
    (message "Error while loading: %s"
             (cdr (plist-get status :error))))
  (prog-mode)
  (forward-paragraph)
  (save-excursion
    (save-match-data
................................................................................
      (sbbs-compose-mode)
      (setq sbbs--board board)
      (switch-to-buffer (current-buffer)))))

(defun sbbs-read-reply (arg)
  "Create buffer to start a reply in current thread.

With \\[universal-argument] add a reply reference to thread at
point."
  (interactive "P")
  (let ((id sbbs--thread-id)
        (nr (get-text-property (point) 'sbbs-thread-nr))
        (board sbbs--board))
    (with-current-buffer (generate-new-buffer "*new response*")
      (sbbs-compose-mode)
      (when (and arg (= (car arg) 4))
................................................................................
                                     (cdr (plist-get status :error)))
                          (kill-buffer buf)
                          (let ((sbbs--board board))
                            (sbbs--reload-thread))))
                  (list (current-buffer)))))

(defun sbbs-read-next (arg)
  "Move point to next thread header."
  (interactive "p")
  (dotimes (_ arg)
    (end-of-line)
    (catch 'found
      (while (search-forward-regexp "^#" nil t)
        (when (eq 'highlight (get-text-property (point) 'face))
          (throw 'found t)))))
  (beginning-of-line))

(defun sbbs-read-previous (arg)
  "Move point to previous thread header."
  (interactive "p")
  (dotimes (_ arg)
    (catch 'found
      (while (search-backward-regexp "^#" nil t)
        (when (eq 'highlight (get-text-property (point) 'face))
          (throw 'found t)))))
  (beginning-of-line))







|







 







|
>







 







|







 







|
|







 







|










|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
...
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
...
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
...
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
           (let* ((text (caddr it))
                  (link (plist-get (cadadr it) 'href)))
             (sbbs--insert-link text link)))
          (t (insert (prin1-to-string it)))))
  (insert ?\n))

(defun sbbs--insert-sxml (sxml)
  "Insert top level SXML into buffer at point."
  (dolist (par sxml)
    (cond ((eq (car par) 'p)
           (sbbs--insert-sxml-par (cdr par)))
          ((eq (car par) 'blockquote)
           (let ((start (point))
                 (comment-start "> "))
             (sbbs--insert-sxml-par (cdadr par))
................................................................................
    (add-text-properties start (point) (list 'sbbs-thread-nr (car post)))))

  ;; URL.EL CALLBACKS

(defun sbbs--board-loader (status buf)
  "Callback function for `url-retrieve' when loading board.

Load results into buffer BUF. STATUS is used to check for
errors."
  (when (plist-get status :error)
    (message "Error while loading: %s"
             (cdr (plist-get status :error))))
  (forward-paragraph)
  (let ((list (read (current-buffer))))
    (kill-buffer)
    (with-current-buffer buf
................................................................................
    (switch-to-buffer buf)
    (hl-line-highlight)))

(defun sbbs--thread-loader (status board id)
  "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."
  (when (plist-get status :error)
    (message "Error while loading: %s"
             (cdr (plist-get status :error))))
  (prog-mode)
  (forward-paragraph)
  (save-excursion
    (save-match-data
................................................................................
      (sbbs-compose-mode)
      (setq sbbs--board board)
      (switch-to-buffer (current-buffer)))))

(defun sbbs-read-reply (arg)
  "Create buffer to start a reply in current thread.

With \\[universal-argument] interactivly, or a non-nil ARG, add a
reply reference to thread at point."
  (interactive "P")
  (let ((id sbbs--thread-id)
        (nr (get-text-property (point) 'sbbs-thread-nr))
        (board sbbs--board))
    (with-current-buffer (generate-new-buffer "*new response*")
      (sbbs-compose-mode)
      (when (and arg (= (car arg) 4))
................................................................................
                                     (cdr (plist-get status :error)))
                          (kill-buffer buf)
                          (let ((sbbs--board board))
                            (sbbs--reload-thread))))
                  (list (current-buffer)))))

(defun sbbs-read-next (arg)
  "Move point ARG posts forward."
  (interactive "p")
  (dotimes (_ arg)
    (end-of-line)
    (catch 'found
      (while (search-forward-regexp "^#" nil t)
        (when (eq 'highlight (get-text-property (point) 'face))
          (throw 'found t)))))
  (beginning-of-line))

(defun sbbs-read-previous (arg)
  "Move point ARG posts backwards."
  (interactive "p")
  (dotimes (_ arg)
    (catch 'found
      (while (search-backward-regexp "^#" nil t)
        (when (eq 'highlight (get-text-property (point) 'face))
          (throw 'found t)))))
  (beginning-of-line))