sbbs.el

Diff
Login

Differences From Artifact [c864d8c09d]:

To Artifact [4c0b868675]:


561
562
563
564
565
566
567



















568
569




570
571
572
573
574
575
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


+
+
+
+






  (setq-local revert-buffer-function #'sbbs--reload-thread))

(defvar sbbs-compose-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-c C-c") #'sbbs-compose-create)
    map))

(defvar sbbs--font-lock
  ;; stolen/based on from http://textboard.org/prog/81/5
  '(;; code
    ("^```\\(.*\n\\)*?```\n?" . 'sbbs--code-face)
    ;; bold
    ("\\*\\*[^ ].*?\\*\\*" . 'bold)
    ;; italic
    ("__[^ ].*?__" . 'italic)
    ;; monospaced
    ("==[^ ].*?==" . 'shadow)
    ;; spoiler
    ("~~[^ ].*?~~" . 'sbbs--spoiler-face)
    ;; references
    (">>\\([[:digit:]]+\\(?:-[[:digit:]]+\\)?\\(?:,[[:digit:]]+\\(?:-[[:digit:]]+\\)?\\)*\\)"
     . 'link)
    ;; quotes
    ("^>.*" . font-lock-comment-face))
  "Highlighting for SchemeBBS posts")

(define-derived-mode sbbs-compose-mode text-mode "SchemeBBS Compose"
  "Major mode for composing replies and starting new threads."
  (setq-local comment-start ">")
  (setq-local comment-start-skip "^>")
  (setq-local font-lock-defaults '(sbbs--font-lock))
  (setq-local font-lock-multiline t)
  (setq-local fill-column most-positive-fixnum)
  (message "Press C-c C-c to send"))

(provide 'sbbs)

;;; sbbs.el ends here