sbbs.el

Check-in [aa9e221e24]
Login
Overview
Comment:Add separate face for post headers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: aa9e221e241b2c3a025a6bd25caa053cd4748754e78758f3ef563495af6bc81d
User & Date: zge on 2020-10-07 17:09:51
Other Links: branch diff | manifest | tags
Context
2020-10-07
17:19
Add a "/" as initial content when prompting to open a board check-in: 43bf3542e7 user: zge tags: master, trunk
17:09
Add separate face for post headers check-in: aa9e221e24 user: zge tags: master, trunk
2020-06-18
13:11
Fixed URL handeling with ","-ranges check-in: df55ff6293 user: zge tags: master, trunk
Changes

Modified sbbs.el from [e334160be5] to [e87c43e082].

76
77
78
79
80
81
82





83
84
85
86
87
88
89
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94







+
+
+
+
+







(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.")

(defface sbbs--post-header-face
  '((nil :extend t
         :inherit highlight))
  "Face for post headers in the thread view.")

 ;; VARIABLES

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

See `sbbs-make-board'.")

344
345
346
347
348
349
350
351

352
353
354
355
356
357
358
349
350
351
352
353
354
355

356
357
358
359
360
361
362
363







-
+







  "Prepare and Insert header and contents of POST at point."
  (let ((start (point)))
    (insert (format "#%d\t%s" (car post)
                    (cdr (assq 'date (cdr post)))))
    (when (cdr (assq 'vip (cdr post)))
      (insert " (VIP)"))
    (newline 2)
    (add-text-properties start (1- (point)) '(face highlight))
    (add-text-properties start (1- (point)) '(face sbbs--post-header-face))
    (set-text-properties (1- (point)) (point) nil)
    (sbbs--insert-sxml (cdr (assq 'content (cdr post))))
    (add-text-properties start (point) (list 'sbbs-thread-nr (car post)))))

(defun sbbs--uncover-spoiler ()
  ""
  (cond ((eq (get-text-property (point) 'face) 'sbbs--spoiler-face)
624
625
626
627
628
629
630
631

632
633
634
635
636
637
638
639
640
641
642
643
644

645
646
647
648
649
650
651
629
630
631
632
633
634
635

636
637
638
639
640
641
642
643
644
645
646
647
648

649
650
651
652
653
654
655
656







-
+












-
+







(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 (and (eq 'highlight (get-text-property (point) 'face))
        (when (and (eq 'sbbs--post-header-face (get-text-property (point) 'face))
                   (not (get-text-property (point) 'invisible)))
          (throw 'found t)))))
  (beginning-of-line)
  (when sbbs-recenter-to-top
    (set-window-start (selected-window) (point))))

(defun sbbs-read-previous (arg)
  "Move point ARG posts backwards."
  (interactive "p")
  (dotimes (_ arg)
    (catch 'found
      (while (search-backward-regexp "^#" nil t)
        (when (and (eq 'highlight (get-text-property (point) 'face))
        (when (and (eq 'sbbs--post-header-face (get-text-property (point) 'face))
                   (not (get-text-property (point) 'invisible)))
          (throw 'found t)))))
  (beginning-of-line)
  (when sbbs-recenter-to-top
    (set-window-start (selected-window) (point))))

;;;###autoload