From 1a6997d1da94f3bed859f5170a1e2f70ce6aa1a0 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Tue, 27 Sep 2022 15:49:13 -0400 Subject: Import comments --- emacsconf.el | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'emacsconf.el') diff --git a/emacsconf.el b/emacsconf.el index f1d1cc8..63fb6f0 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -680,5 +680,44 @@ Include some other things, too, such as emacsconf-year, title, name, email, url, time emacsconf-timezone)))) +;;; Etherpad +(defun emacsconf-import-comments-from-etherpad-text (filename) + (interactive "FEtherpad text export: ") + (with-temp-buffer + (insert-file-contents filename) + (goto-char (point-min)) + (while (re-search-forward "^\t+Comments for \\([^:]+\\)" nil t) + (let ((slug (match-string 1)) + comments) + (forward-line 1) + (setq comments + (split-string + (replace-regexp-in-string + "\t\t\\*" + "- " + (buffer-substring-no-properties + (point) + (if (re-search-forward "^[^\t]" nil t) + (match-beginning 0) + (point-max)))) + "\n")) + (save-window-excursion + (emacsconf-with-talk-heading slug + ;; Do we already have a heading for comments? + (if (re-search-forward "^\\(\\*+\\) +Review comments" (save-excursion (org-end-of-subtree)) t) + (org-end-of-meta-data) + (org-end-of-subtree) + (org-insert-heading-after-current) + (insert "Review comments\n")) + ;; Are these comments already included? + (save-restriction + (org-narrow-to-subtree) + (mapc (lambda (o) + (goto-char (point-min)) + (unless (re-search-forward (regexp-quote o) nil t) + (goto-char (point-max)) + (unless (bolp) (insert "\n")) + (insert o "\n"))) + comments)))))))) (provide 'emacsconf) ;;; emacsconf.el ends here -- cgit v1.2.3