This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new 755f703dc Document ‘in-vicinity’.
755f703dc is described below

commit 755f703dcb3110e1920e42078edc6d9c88cc8b28
Author: Ludovic Courtès <l...@gnu.org>
AuthorDate: Wed Jun 18 11:29:22 2025 +0200

    Document ‘in-vicinity’.
    
    * module/ice-9/boot-9.scm (in-vicinity): Rename ‘vicinity’ to
    ‘directory’.  Add docstring.
    * doc/ref/posix.texi (File System): Document it.
    
    Suggested-by: Maxim Cournoyer <maxim.courno...@gmail.com>
---
 doc/ref/posix.texi      |  5 +++++
 module/ice-9/boot-9.scm | 13 ++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi
index 08d939b9f..5990322a4 100644
--- a/doc/ref/posix.texi
+++ b/doc/ref/posix.texi
@@ -1223,6 +1223,11 @@ valid separators.  Thus, programs should not assume that
 separator---e.g., when extracting the components of a file name.
 @end defvr
 
+@deffn {Scheme Procedure} in-vicinity @var{directory} @var{file}
+Concatenate @var{directory} and @var{file}, adding
+@code{file-name-separator-string} (by default slash) in between if it is
+not already present.  This helps create file names.
+@end deffn
 
 @node User Information
 @subsection User Information
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 04f84215c..aaa998702 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -1,6 +1,6 @@
 ;;; -*- mode: scheme; coding: utf-8; -*-
 
-;;;; Copyright (C) 1995-2014, 2016-2024  Free Software Foundation, Inc.
+;;;; Copyright (C) 1995-2014, 2016-2025  Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -2144,12 +2144,15 @@ non-locally, that exit determines the continuation."
                (file-name-separator-at-index? 2)
                (file-name-separator-at-index? 0)))))))
 
-(define (in-vicinity vicinity file)
-  (let ((tail (let ((len (string-length vicinity)))
+(define (in-vicinity directory file)
+  "Concatenate @var{directory} and @var{file}, adding
+@code{file-name-separator-string} (by default slash) in between if it is
+not already present.  This helps create file names."
+  (let ((tail (let ((len (string-length directory)))
                 (if (zero? len)
                     #f
-                    (string-ref vicinity (- len 1))))))
-    (string-append vicinity
+                    (string-ref directory (- len 1))))))
+    (string-append directory
                    (if (or (not tail) (file-name-separator? tail))
                        ""
                        file-name-separator-string)

Reply via email to