sbbs.el

Diff
Login

Differences From Artifact [1c7c7f43da]:

To Artifact [a7ead60032]:


59
60
61
62
63
64
65




66
67
68
69
70
71
72
(defcustom sbbs-recenter-to-top nil
  "Move point to top of frame when moving through posts."
  :type 'boolean)

(defcustom sbbs-open-at-last-post nil
  "Jump to last post in a thread when opening a thread."
  :type 'boolean)





(defface sbbs--semi-spoiler-face
  '((((background light)) :background "gray80" :foreground "black")
    (((background dark)) :background "gray20" :foreground "white"))
  "Face for spoiler text in threads.")

(defface sbbs--spoiler-face







>
>
>
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
(defcustom sbbs-recenter-to-top nil
  "Move point to top of frame when moving through posts."
  :type 'boolean)

(defcustom sbbs-open-at-last-post nil
  "Jump to last post in a thread when opening a thread."
  :type 'boolean)

(defcustom sbbs-kill-threads-on-quit t
  "Kill all thread buffers when quitting a board buffer."
  :type 'boolean)

(defface sbbs--semi-spoiler-face
  '((((background light)) :background "gray80" :foreground "black")
    (((background dark)) :background "gray20" :foreground "white"))
  "Face for spoiler text in threads.")

(defface sbbs--spoiler-face
223
224
225
226
227
228
229








230
231
232
233
234
235
236
      (cond ((< nr current) (setq down (point)))
            ((> nr current) (setq up (point))))))
  (unless (and (eq 'highlight (get-text-property (point) 'face))
               (looking-at-p "\\`#[[:digit:]]+"))
    ;; in case we are on the first character of a post, we shouldn't
    ;; jump back, since that would mean setting to point to NR-1.
    (sbbs-read-previous 1)))










;;; UI GENERATOR

(defconst sbbs--link-regexp
  (rx-to-string
   `(: bos







>
>
>
>
>
>
>
>







227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
      (cond ((< nr current) (setq down (point)))
            ((> nr current) (setq up (point))))))
  (unless (and (eq 'highlight (get-text-property (point) 'face))
               (looking-at-p "\\`#[[:digit:]]+"))
    ;; in case we are on the first character of a post, we shouldn't
    ;; jump back, since that would mean setting to point to NR-1.
    (sbbs-read-previous 1)))

(defun sbbs--cleanup-board ()
  "Close all thread buffers for the current board."
  (when sbbs-kill-threads-on-quit
    (dolist (buf (buffer-list))
      (when (and (eq (buffer-local-value 'sbbs--board buf) sbbs--board)
                 (buffer-local-value 'sbbs--thread-id buf))
        (kill-buffer buf)))))


;;; UI GENERATOR

(defconst sbbs--link-regexp
  (rx-to-string
   `(: bos
753
754
755
756
757
758
759



760
761
762
763
764
765
766
  "Major mode for browsing a SchemeBBS board."
  (buffer-disable-undo)

  (setq tabulated-list-format [("Date" 16 t)
                               ("#" 3 t :right-align t)
                               ("Headline" 0 nil)]
        tabulated-list-sort-key '("Date" . t))



  (add-hook 'tabulated-list-revert-hook
            #'sbbs--reload-board nil t)
  (tabulated-list-init-header)

  (hl-line-mode t))

(defvar sbbs-read-mode-map







>
>
>







765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
  "Major mode for browsing a SchemeBBS board."
  (buffer-disable-undo)

  (setq tabulated-list-format [("Date" 16 t)
                               ("#" 3 t :right-align t)
                               ("Headline" 0 nil)]
        tabulated-list-sort-key '("Date" . t))
  (add-hook 'quit-window-hook
            'sbbs--cleanup-board
            nil t)
  (add-hook 'tabulated-list-revert-hook
            #'sbbs--reload-board nil t)
  (tabulated-list-init-header)

  (hl-line-mode t))

(defvar sbbs-read-mode-map