[bug#70830] doc: Document assume-valid-file-name in local-file

Message ID 9832f834c7b20b664554f4cc8090f0bf1f0a96ae.1715170671.git.richard@freakingpenguin.com
State New
Headers
Series [bug#70830] doc: Document assume-valid-file-name in local-file |

Commit Message

Richard Sent May 8, 2024, 12:17 p.m. UTC
doc/guix.texi (G-Expressions): Document the use of assume-valid-file-name with
local-file.
---
Hi Guix!

I found it odd that assume-valid-file-name isn't documented in the
manual. Well, now it is!

 doc/guix.texi | 12 ++++++++++++
 1 file changed, 12 insertions(+)


base-commit: da41a8f5e85774e2a507d821b5d52e600fb9d1d7
  

Comments

Richard Sent May 8, 2024, 6:27 p.m. UTC | #1
I submitted another patch (https://qa.guix.gnu.org/issue/70829) which
accidentally depends on this one. I'll resubmit to that issue as a
series since the documentation changes are tied together a bit anyway.
  
Ludovic Courtès May 25, 2024, 2:19 p.m. UTC | #2
Hi,

Richard Sent <richard@freakingpenguin.com> skribis:

> doc/guix.texi (G-Expressions): Document the use of assume-valid-file-name with
> local-file.

Applied, thanks!

Ludo’.
  
Richard Sent May 25, 2024, 2:24 p.m. UTC | #3
Hi Ludo!

>> I submitted another patch (https://qa.guix.gnu.org/issue/70829)which
>> accidentally depends on this one. I'll resubmit to that issue as a
>> series since the documentation changes are tied together a bit
>> anyway.

Will applying this patch mess up 70829? My intent was to close 70830 and
combine it with 70829, although if the other changes in 70829 aren't
deemed suitable for a merge then there's no need to worry.

Thanks!
  

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 1c1e0164e7..221db5c022 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12154,6 +12154,18 @@  G-Expressions
 absolute file name and @var{stat} is the result of @code{lstat}; exclude
 entries for which @var{select?} does not return true.
 
+@var{file} can be wrapped in the @code{assume-valid-file-name} syntactic
+keyword. When this is done, there will not be a warning when
+@code{local-file} is used with a non-literal path.  The path is still
+looked up relative to the current working directory at run time.
+Wrapping is done like this:
+
+@lisp
+(define alice-key-file-path "alice.pub")
+;; ...
+(local-file (assume-valid-file-name alice-key-file-path))
+@end lisp
+
 This is the declarative counterpart of the @code{interned-file} monadic
 procedure (@pxref{The Store Monad, @code{interned-file}}).
 @end deffn