sbbs.el

Diff
Login

Differences From Artifact [cec4081882]:

To Artifact [47b32ff1b0]:


63
64
65
66
67
68
69







70
71
72
73
74
75
76
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83







+
+
+
+
+
+
+







  "Face for spoiler text in threads.")

(defface sbbs--code-face
  '((((background light)) :background "gray89" :extend t)
    (((background dark)) :background "gray11" :extend t))
  "Face for code blocks in threads.")

(defface sbbs--variable-pitch
  (if (x-list-fonts "Mona-")
      '((nil :font "Mona"
             :inherit variable-pitch))
    '((nil :inherit variable-pitch)))
  "Face for code blocks in threads.")

 ;; VARIABLES

(defvar-local sbbs--board nil
  "Buffer local reference to current board.

See `sbbs-make-board'.")

259
260
261
262
263
264
265
266

267
268
269
270
271
272
273

274
275
276
277

278
279

280
281
282
283
284
285
286
266
267
268
269
270
271
272

273
274
275
276
277
278
279

280
281
282
283

284
285

286
287
288
289
290
291
292
293







-
+






-
+



-
+

-
+







                              (sbbs-view-open id range)))
                           ;; other thread
                           ((/= id sbbs--thread-id)
                            (let ((sbbs--board board))
                              (sbbs-view-open id range)))
                           ;; this thread
                           (range (sbbs--limit-to-range range))))))
        (insert-button (propertize text  'face 'variable-pitch)
        (insert-button (propertize text  'face 'sbbs--variable-pitch)
                       'action func 'sbbs-ref range)))))

(defun sbbs--insert-sxml-par (sxml)
  "Insert paragraph contents SXML at point."
  (dolist (it sxml)
    (cond ((stringp it)
           (insert (propertize it 'face 'variable-pitch)))
           (insert (propertize it 'face 'sbbs--variable-pitch)))
          ((eq (car it) 'br)
           (newline))
          ((eq (car it) 'b)
           (insert (propertize (cadr it) 'face '(bold variable-pitch))))
           (insert (propertize (cadr it) 'face '(bold sbbs--variable-pitch))))
          ((eq (car it) 'i)
           (insert (propertize (cadr it) 'face '(italic variable-pitch))))
           (insert (propertize (cadr it) 'face '(italic sbbs--variable-pitch))))
          ((eq (car it) 'code)
           (insert (propertize (cadr it) 'face 'fixed-pitch)))
          ((eq (car it) 'del)
           (insert (propertize (cadr it) 'face 'sbbs--spoiler-face)))
          ((eq (car it) 'a)
           (let* ((text (caddr it))
                  (link (plist-get (cadadr it) 'href)))
384
385
386
387
388
389
390
391

392
393
394
395
396
397
398
391
392
393
394
395
396
397

398
399
400
401
402
403
404
405







-
+







            (push (list (car thread)
                        (vector (substring (cdr (assq 'date (cdr thread)))
                                           0 16)
                                (number-to-string
                                 (cdr (assq 'messages (cdr thread))))
                                (propertize
                                 (cdr (assq 'headline (cdr thread)))
                                 'face 'variable-pitch)))
                                 'face 'sbbs--variable-pitch)))
                  ent))
          (setq-local tabulated-list-entries ent)
          (tabulated-list-print t t)
          (hl-line-highlight))))))

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