Index: sbbs.el ================================================================== --- sbbs.el +++ sbbs.el @@ -546,19 +546,21 @@ sbbs--board board) (switch-to-buffer (current-buffer))))) (defun sbbs-compose-format (style) "Insert string STYLE around region or point." - (save-mark-and-excursion + (save-excursion (if (region-active-p) - (progn - (goto-char (region-beginning)) + (let ((beg (region-beginning)) + (end (region-end))) + (goto-char end) (insert style) - (goto-char (region-end)) + (goto-char beg) (insert style)) (insert style style))) - (forward-char (length style))) + (when (< (point) (mark)) + (forward-char (length style)))) (defun sbbs-compose-format-code () "Insert code syntax markers." (interactive) (sbbs-compose-format "```\n"))