[ prog / sol / mona ]

prog


Emacs mode for SchemeBBS markup

79 2021-08-27 01:40

>>76,77
We need only traverse in reverse. The terminal newline breaks the initial 'action property if it exists.

(defun sbbs--insert-sxml-par (sxml)
  "Insert paragraph contents SXML at point."
  (save-restriction
    (narrow-to-region (point) (point))
    (insert (sbbs--process-sxml sxml) "\n")
    (let (end)
      (while (setq end (previous-single-property-change (point) 'action))
        ;; Buttons use overlays that cannot be passed in
        ;; strings. Therefore whenever a `activity' property was inserted into
        ;; the buffer, `make-button' has to be called once more to add the
        ;; actual overlay.
        (let ((beg (previous-single-property-change end 'action nil (point-min))))
          (make-button beg end 'action (get-text-property beg 'action))
          (goto-char beg)))
      (goto-char (point-max)))))
86


VIP:

do not edit these