summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorArun Isaac2021-07-04 19:46:43 +0530
committerArun Isaac2021-07-04 19:46:43 +0530
commit3ca3bd1022b16c26811af86d48a85e9e74f2c00a (patch)
tree4003ff0690d05ed512f9dbd618679e9505857a4c /doc
parent4569b62babd486da75adeb856811ef411d8d2ead (diff)
downloadccwl-3ca3bd1022b16c26811af86d48a85e9e74f2c00a.tar.gz
ccwl-3ca3bd1022b16c26811af86d48a85e9e74f2c00a.tar.lz
ccwl-3ca3bd1022b16c26811af86d48a85e9e74f2c00a.zip
doc: Remove redundant file open.
* doc/skribilo.scm (source-ref): Remove redundant file open.
Diffstat (limited to 'doc')
-rw-r--r--doc/skribilo.scm30
1 files changed, 14 insertions, 16 deletions
diff --git a/doc/skribilo.scm b/doc/skribilo.scm
index 4a1eda0..3438b82 100644
--- a/doc/skribilo.scm
+++ b/doc/skribilo.scm
@@ -108,22 +108,20 @@ and END are line numbers indexed from 1."
              (position->line-number str end))))))
 
 (define (source-ref file regexp text)
-  (call-with-input-file file
-    (lambda (port)
-      (ref #:url (match (sexp-file-lines file regexp)
-                   ((start-line . end-line)
-                    (if (= start-line end-line)
-                        (string-append %source-uri-base
-                                       file
-                                       "#L"
-                                       (number->string start-line))
-                        (string-append %source-uri-base
-                                       file
-                                       "#L"
-                                       (number->string start-line)
-                                       "-L"
-                                       (number->string end-line)))))
-           #:text text))))
+  (ref #:url (match (sexp-file-lines file regexp)
+               ((start-line . end-line)
+                (if (= start-line end-line)
+                    (string-append %source-uri-base
+                                   file
+                                   "#L"
+                                   (number->string start-line))
+                    (string-append %source-uri-base
+                                   file
+                                   "#L"
+                                   (number->string start-line)
+                                   "-L"
+                                   (number->string end-line)))))
+       #:text text))
 
 ;; HTML engine customizations
 (let ((html-engine (find-engine 'html)))