From 5a75bbff7852752ffb09afc57b171dfcf4dbd51a Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Sat, 10 Jul 2021 12:12:46 -0400 Subject: doc-lookup: ignore BROWSER when empty. * stdlib/doc-lookup.tl (open-url): Treat empty BROWSER variable as if it were unset (i.e., ignore it). Otherwise the doc function silently fails rather than falling back to alternative URL-opening methods. * txr.1: Documented. --- stdlib/doc-lookup.tl | 16 ++++++++-------- txr.1 | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/stdlib/doc-lookup.tl b/stdlib/doc-lookup.tl index e939aa2a..231d3b62 100644 --- a/stdlib/doc-lookup.tl +++ b/stdlib/doc-lookup.tl @@ -36,14 +36,14 @@ (fallback '#"firefox iceweasel seamonkey mozilla \ epiphany konqueror chromium chromium-browser \ google-chrome")) - (let ((prog (or (getenv "BROWSER") - (if (abs-path-p opener) - opener - (path-search opener)) - [find-true path-search fallback]))) - (if prog - (detached-run prog (list url)) - (error "~s: no URL-opening method available" 'open-url)))))) + (iflet ((prog (getenv "BROWSER")) + (prog (or (and (plusp (len prog)) prog) + (if (abs-path-p opener) + opener + (path-search opener)) + [find-true path-search fallback]))) + (detached-run prog (list url)) + (error "~s: no URL-opening method available" 'open-url))))) ((:cygwin :cygnal) (with-dyn-lib "shell32.dll" (deffi shell-execute "ShellExecuteW" diff --git a/txr.1 b/txr.1 index c035ba39..82f53081 100644 --- a/txr.1 +++ b/txr.1 @@ -82571,9 +82571,10 @@ function is relied upon to open the URL. On other platforms, if the .code BROWSER -environment variable exists, its value is assumed to indicate the -name or path of the web-browsing program which can accept the URL -as an argument. If this variable doesn't exist, then +environment variable exists and is nonempty, +its value is assumed to indicate the name or path +of the web-browsing program which can accept the URL as an argument. +If this variable doesn't exist or is empty, then .code doc searches for a system-dependent URL-opening utility, such as .codn xdg-open . -- cgit v1.2.3