sbbs.el

Check-in [a3e4eb41e0]
Login
Overview
Comment:Kill thread buffers when quitting board buffer
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: a3e4eb41e0b87f34b669e70f041719f7c31aec1508a4e30c73b5a03c0308dbd5
User & Date: zge on 2022-01-22 18:57:01
Other Links: branch diff | manifest | tags
Context
2022-01-24
09:11
Fix /mona/ check-in: d0b75dd168 user: zge tags: master, trunk
2022-01-22
18:57
Kill thread buffers when quitting board buffer check-in: a3e4eb41e0 user: zge tags: master, trunk
18:49
Always kill HTTP response buffer after processing it check-in: 67d30a2317 user: zge tags: master, trunk
Changes

Modified sbbs.el from [1c7c7f43da] to [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