sbbs.el

Diff
Login

Differences From Artifact [1c7c7f43da]:

To Artifact [a7ead60032]:


    59     59   (defcustom sbbs-recenter-to-top nil
    60     60     "Move point to top of frame when moving through posts."
    61     61     :type 'boolean)
    62     62   
    63     63   (defcustom sbbs-open-at-last-post nil
    64     64     "Jump to last post in a thread when opening a thread."
    65     65     :type 'boolean)
           66  +
           67  +(defcustom sbbs-kill-threads-on-quit t
           68  +  "Kill all thread buffers when quitting a board buffer."
           69  +  :type 'boolean)
    66     70   
    67     71   (defface sbbs--semi-spoiler-face
    68     72     '((((background light)) :background "gray80" :foreground "black")
    69     73       (((background dark)) :background "gray20" :foreground "white"))
    70     74     "Face for spoiler text in threads.")
    71     75   
    72     76   (defface sbbs--spoiler-face
................................................................................
   223    227         (cond ((< nr current) (setq down (point)))
   224    228               ((> nr current) (setq up (point))))))
   225    229     (unless (and (eq 'highlight (get-text-property (point) 'face))
   226    230                  (looking-at-p "\\`#[[:digit:]]+"))
   227    231       ;; in case we are on the first character of a post, we shouldn't
   228    232       ;; jump back, since that would mean setting to point to NR-1.
   229    233       (sbbs-read-previous 1)))
          234  +
          235  +(defun sbbs--cleanup-board ()
          236  +  "Close all thread buffers for the current board."
          237  +  (when sbbs-kill-threads-on-quit
          238  +    (dolist (buf (buffer-list))
          239  +      (when (and (eq (buffer-local-value 'sbbs--board buf) sbbs--board)
          240  +                 (buffer-local-value 'sbbs--thread-id buf))
          241  +        (kill-buffer buf)))))
   230    242   
   231    243   
   232    244   ;;; UI GENERATOR
   233    245   
   234    246   (defconst sbbs--link-regexp
   235    247     (rx-to-string
   236    248      `(: bos
................................................................................
   753    765     "Major mode for browsing a SchemeBBS board."
   754    766     (buffer-disable-undo)
   755    767   
   756    768     (setq tabulated-list-format [("Date" 16 t)
   757    769                                  ("#" 3 t :right-align t)
   758    770                                  ("Headline" 0 nil)]
   759    771           tabulated-list-sort-key '("Date" . t))
          772  +  (add-hook 'quit-window-hook
          773  +            'sbbs--cleanup-board
          774  +            nil t)
   760    775     (add-hook 'tabulated-list-revert-hook
   761    776               #'sbbs--reload-board nil t)
   762    777     (tabulated-list-init-header)
   763    778   
   764    779     (hl-line-mode t))
   765    780   
   766    781   (defvar sbbs-read-mode-map