Paul Fox <[email protected]> writes:

> lyndon wrote:
>  > 
>  > 
>  > On May 15, 2014, at 7:09, [email protected] wrote:
>  > 
>  > > I installed w3n and elinks but nmh is not using them:
>  > 
>  > Given all the grief people have been experiencing getting HTML
>  > rendering tools to work, perhaps we should consider importing
>  > Plan9's htmlfmt(1) and using it as the default renderer.
>
> this may well be a good idea, but it feels like much of norm's problem
> was that the relevant configuration is done at build time.  if the
> default mhshow-show-text/html entry pointed to a helper script, rather
> than to a specific browser, that script could search for and run an
> appropriate browser at run-time, probably using the same list we
> currently look through at build time.
>
> (how do pre-built nmh packages handle this?  simply with dependencies
> on the necessary text browsers?  if we were to provide our own simple
> renderer as lyndon suggests, those dependencies could become
> suggestions.)

Debian provides scripts such as sensible-browser (attached) which can
find an appropriate program using either a user-set $BROWSER or one of
the applicable symbolic links gnome-www-browser, x-www-browser, or
www-browser, which are maintained by the package manager. In my case,
the latter points to w3m.

If sensible-browser exists, we should use it.

-- 
Bill Wohler <[email protected]> aka <[email protected]>
http://www.newt.com/wohler/
GnuPG ID:610BD9AD

#!/bin/sh

URL="$1"

if test -n "$BROWSER"; then
    OLDIFS="$IFS"
    IFS=:
    for i in $BROWSER; do
	case "$i" in
	    (*sensible-browser*)
	    printf 'Using sensible-browser in $BROWSER makes no sense.\n' >&2
	    exit 1
	    ;;
	    (*%s*)
	    :
	    ;;
	    (*)
	    i="$i %s"
	    ;;
	esac
        IFS="$OLDIFS"
        cmd=$(printf "$i\n" "$URL")
        $cmd && exit 0
    done
    printf 'None of the browsers in $BROWSER worked!\n' >&2
    exit 1
fi

if test -n "$DISPLAY"; then
    if test -n "$GNOME_DESKTOP_SESSION_ID"; then
        if test -x /usr/bin/gnome-www-browser; then
            exec /usr/bin/gnome-www-browser ${URL:+"$URL"}
        elif test -x /usr/bin/x-www-browser; then
            exec /usr/bin/x-www-browser ${URL:+"$URL"}
        elif test -x /usr/bin/gnome-terminal && test -x /usr/bin/www-browser; then
            exec /usr/bin/gnome-terminal -e "/usr/bin/www-browser ${URL:+\"$URL\"}"
        fi
    fi
    if test -x /usr/bin/x-www-browser; then
        exec /usr/bin/x-www-browser ${URL:+"$URL"}
    elif test -x /usr/bin/x-terminal-emulator && test -x /usr/bin/www-browser; then
        exec /usr/bin/x-terminal-emulator -e /usr/bin/www-browser ${URL:+"$URL"}
    fi
elif test -x /usr/bin/www-browser; then
    exec /usr/bin/www-browser ${URL:+"$URL"}
fi

printf "Couldn't find a suitable web browser!\n" >&2
printf "Set the BROWSER environment variable to your desired browser.\n" >&2
exit 1;
_______________________________________________
Nmh-workers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/nmh-workers

Reply via email to