changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/organ/util.lisp

changeset 698: 96958d3eb5b0
parent: 78ef6145e272
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; lib/organ/util.lisp --- Organ Utils
2 
3 ;;
4 
5 ;;; Code:
6 (in-package :organ)
7 
8 (defun peek-line (stream)
9  (concatenate
10  'string
11  (loop for c = (peek-char nil stream nil nil)
12  until (or (not c) (char= c #\newline))
13  collect c)))
14 
15 (defun read-until-end (stream)
16  (with-output-to-string (s)
17  (loop for c = (read-char stream nil)
18  until (not c)
19  do (write-char c s))))
20 
21 (defun read-org-lines (&optional stream)
22  (apply #'vector
23  (loop for l = (read-line stream nil)
24  until (not l)
25  collect l)))
26 
27 (defun read-org-lines-from-string (str)
28  (with-input-from-string (s str) (read-org-lines s)))
29 
30 ;; (sym-to-org-class-name 'headline)
31 (eval-always
32 (defun sym-to-org-class-name (sym)
33  "Convert keyword or symbol SYM to a symbol which could designate an ORG- object type."
34  (intern (format nil "~:@(~a~a~)" "org-" sym) :organ)))