484
485
486
487
488
489
490
491
492
493
494
495
496
497
|
(insert (format ">>%d" nr))
(newline))
(setq header-line-format (format "Responding to Thread %d" id)
sbbs--thread-id id
sbbs--board board)
(switch-to-buffer (current-buffer)))))
(defun sbbs-compose-create ()
"Upload response or thread to board."
(interactive)
(let ((board sbbs--board)
(url-request-method "POST")
(url-request-extra-headers
'(("Content-Type" . "application/x-www-form-urlencoded")))
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
|
(insert (format ">>%d" nr))
(newline))
(setq header-line-format (format "Responding to Thread %d" id)
sbbs--thread-id id
sbbs--board board)
(switch-to-buffer (current-buffer)))))
(defun sbbs-compose-format (style)
"Insert "
(if (region-active-p)
(save-excursion
(goto-char (region-beginning))
(insert "style")
(goto-char (region-end))
(insert "style"))
(insert style style)
(forward-char (- (length style)))))
(defun sbbs-compose-format-code ()
"Insert code syntax markers."
(interactive)
(sbbs-compose-format "```\n"))
(defun sbbs-compose-format-bold ()
"Insert bold syntax markers."
(interactive)
(sbbs-compose-format "**"))
(defun sbbs-compose-format-italic ()
"Insert italic syntax markers."
(interactive)
(sbbs-compose-format "__"))
(defun sbbs-compose-format-verbatim ()
"Insert verbatim syntax markers."
(interactive)
(sbbs-compose-format "=="))
(defun sbbs-compose-format-spoiler ()
"Insert spoiler syntax markers."
(interactive)
(sbbs-compose-format "~~"))
(defun sbbs-compose-unformat ()
(interactive)
(when (search-backward-regexp "\\(\\*\\*\\|==\\|__\\|~~\\)" nil t)
(looking-at (concat "\\(" (regexp-quote (match-string 1)) "\\).*?"
"\\(" (regexp-quote (match-string 1)) "\\)"))
(replace-match "" nil nil nil 2)
(replace-match "" nil nil nil 1)))
(defun sbbs-compose-create ()
"Upload response or thread to board."
(interactive)
(let ((board sbbs--board)
(url-request-method "POST")
(url-request-extra-headers
'(("Content-Type" . "application/x-www-form-urlencoded")))
|
601
602
603
604
605
606
607
608
609
610
611
612
613
614
|
(visual-line-mode t)
(setq-local revert-buffer-function #'sbbs--reload-thread)
(add-hook 'post-command-hook #'sbbs--uncover-spoiler
nil t))
(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)
|
>
>
>
>
>
>
|
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
|
(visual-line-mode t)
(setq-local revert-buffer-function #'sbbs--reload-thread)
(add-hook 'post-command-hook #'sbbs--uncover-spoiler
nil t))
(defvar sbbs-compose-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c C-f C-b") #'sbbs-compose-format-bold)
(define-key map (kbd "C-c C-f C-i") #'sbbs-compose-format-italic)
(define-key map (kbd "C-c C-f C-v") #'sbbs-compose-format-verbatim)
(define-key map (kbd "C-c C-f C-s") #'sbbs-compose-format-spoiler)
(define-key map (kbd "C-c C-f C-c") #'sbbs-compose-format-code)
(define-key map (kbd "C-c C-f C-d") #'sbbs-compose-unformat)
(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)
|