sbbs.el

Check-in [99f8459c8b]
Login
Overview
Comment:Add sbbs-goto-end for jumping to the end of a thread
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 99f8459c8be2e69ce144b791156cb43df31319d538b275c9e0b36a2fe4709d6e
User & Date: zge on 2021-01-19 15:39:17
Other Links: branch diff | manifest | tags
Context
2021-01-22
17:08
Make sbbs-read-board prompt easier to use check-in: b0f8109722 user: zge tags: master, trunk
2021-01-19
15:39
Add sbbs-goto-end for jumping to the end of a thread check-in: 99f8459c8b user: zge tags: master, trunk
10:39
Ensure valid board names are entered check-in: aabf564004 user: zge tags: master, trunk
Changes

Modified sbbs.el from [d9b39dbe32] to [c6978dc733].

53
54
55
56
57
58
59




60
61
62
63
64
65
66
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70







+
+
+
+







(defcustom sbbs-jump-to-link t
  "Jump to first link after narrowing posts."
  :type 'boolean)

(defcustom sbbs-recenter-to-top t
  "Move point to top of frame when moving through posts."
  :type 'boolean)

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

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

(defface sbbs--uncover-spoiler-face
461
462
463
464
465
466
467


468

469
470
471
472
473
474
475
465
466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
481







+
+
-
+







                (format "Thread %d: %s" id
                        (cdr (assq 'headline thread))))
          (dolist (post (cadr (assq 'posts thread)))
            (sbbs--thread-insert-post post))
          (delete-blank-lines)
          (when range
            (sbbs--limit-to-range range))
          (if sbbs-open-at-last-post
              (sbbs-goto-end)
          (goto-char (point-min)))))))
            (goto-char (point-min))))))))

 ;; INTERACTIVE FUNCTIONS

(defun sbbs-show-all ()
  "Show all hidden posts."
  (interactive)
  (sbbs-show-pop -1))
649
650
651
652
653
654
655







656
657
658
659
660
661
662
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675







+
+
+
+
+
+
+







        (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-goto-end ()
  "Jump to last message in the curren thread."
  (interactive)
  (goto-char (point-max))
  (let ((sbbs-recenter-to-top nil))
    (sbbs-read-previous 1)))

;;;###autoload
(defun sbbs-browse (board reload)
  "Open thread overview for BOARD."
  (interactive (list (sbbs-read-board) nil))
  (let* ((name (format "*browsing /%s/*" (sbbs--board-name board)))
         (url (sbbs--board-url "list" t board)))
    (if (and (get-buffer name) (not reload))
699
700
701
702
703
704
705


706
707


708
709
710
711
712
713
714
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731







+
+


+
+







    (suppress-keymap map)
    (define-key map (kbd "<tab>") #'forward-button)
    (define-key map (kbd "<backtab>") #'backward-button)
    (define-key map (kbd "r") #'sbbs-read-reply)
    (define-key map (kbd "n") #'sbbs-read-next)
    (define-key map (kbd "p") #'sbbs-read-previous)
    (define-key map (kbd "a") #'sbbs-show-pop)
    (define-key map (kbd "u") #'sbbs-show-pop)
    (define-key map (kbd "l") #'sbbs-show-pop)
    (define-key map (kbd "A") #'sbbs-show-all)
    (define-key map (kbd "f") #'sbbs-show-replies)
    (define-key map (kbd "e") #'sbbs-goto-end)
    (define-key map (kbd ">") #'sbbs-goto-end)
    map))

(define-derived-mode sbbs-read-mode special-mode "SchemeBBS Read"
  "Major mode for reading a thread."
  (buffer-disable-undo)
  (visual-line-mode t)
  (setq-local revert-buffer-function #'sbbs--reload-thread)