66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
+
+
+
+
|
(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)
(defcustom sbbs-format-word-at-point t
"Format the word at point if no region is active."
: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
|
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
|
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
|
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
sbbs--thread-id id
sbbs--board board)
(switch-to-buffer (current-buffer)))))
(defun sbbs-compose-format (style)
"Insert string STYLE around region or point."
(save-excursion
(cond
(if (region-active-p)
(let ((beg (region-beginning))
(end (region-end)))
(goto-char end)
(insert style)
(goto-char beg)
(insert style))
(insert style style)))
((use-region-p)
(let ((beg (region-beginning))
(end (region-end)))
(goto-char end)
(insert style)
(goto-char beg)
(insert style)))
(sbbs-format-word-at-point
(save-mark-and-excursion
(let ((bounds (bounds-of-thing-at-point 'word)))
(if bounds
(progn
(set-mark (car bounds))
(goto-char (cdr bounds))
(sbbs-compose-format style))
(let ((sbbs-format-word-at-point nil))
(sbbs-compose-format style))))))
((insert style style))))
(when (or (not (region-active-p)) (< (point) (mark)))
(forward-char (length style))))
(defun sbbs-compose-format-code ()
"Insert code syntax markers."
(interactive)
(sbbs-compose-format "```\n"))
|