diff --git a/Makefile.in b/Makefile.in index c050343..cdeed3e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -308,6 +308,7 @@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MAN = @MAN@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ diff --git a/configure b/configure index e0b1ece..fc02876 100755 --- a/configure +++ b/configure @@ -594,6 +594,7 @@ GIT OPENSSL XDG_OPEN BASH +MAN UNZIP GPG CURL @@ -6362,6 +6363,53 @@ if test "$UNZIP" = "no" ; then $as_echo "$as_me: WARNING: Can not find unzip, genpub support will be disabled." >&2;} fi +# Extract the first word of "man", so it can be a program name with args. +set dummy man; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MAN+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAN in + [\\/]* | ?:[\\/]*) + ac_cv_path_MAN="$MAN" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MAN="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_MAN" && ac_cv_path_MAN="no" + ;; +esac +fi +MAN=$ac_cv_path_MAN +if test -n "$MAN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAN" >&5 +$as_echo "$MAN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +if test "$MAN" = "no" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can not find man." >&5 +$as_echo "$as_me: WARNING: Can not find man." >&2;} +fi + # Extract the first word of "bash", so it can be a program name with args. set dummy bash; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 diff --git a/configure.ac b/configure.ac index fa2a53a..e3c7eb4 100644 --- a/configure.ac +++ b/configure.ac @@ -49,6 +49,12 @@ if test "$UNZIP" = "no" ; then AC_MSG_WARN([Can not find unzip, genpub support will be disabled.]) fi +AC_PATH_PROG([MAN],[man],[no]) + +if test "$MAN" = "no" ; then + AC_MSG_WARN([Can not find man.]) +fi + AC_PATH_PROG([BASH],[bash],[no]) if test "$BASH" = "no" ; then diff --git a/etc/init.lisp b/etc/init.lisp index e59b70a..e2752ae 100644 --- a/etc/init.lisp +++ b/etc/init.lisp @@ -143,6 +143,8 @@ (define-key "C-h a" #'apropos-help) +(define-key "C-h m" #'open-manual) + (define-key "!" #'gemini-search) (define-key ">" #'open-gemini-address) diff --git a/src/config.lisp.in.in b/src/config.lisp.in.in index 4356376..6dff526 100644 --- a/src/config.lisp.in.in +++ b/src/config.lisp.in.in @@ -19,10 +19,18 @@ (alexandria:define-constant +unzip-bin+ "@UNZIP@" :test #'string=) +(alexandria:define-constant +man-bin+ "@MAN@" :test #'string=) + (eval-when (:compile-toplevel :load-toplevel :execute) - (when (and (not (member :gempub-support *features*)) - (string/= +unzip-bin+ "no")) - (push :gempub-support *features*))) + + (defun allow-features (test-value feature-keyword) + (when (and (not (member feature-keyword *features*)) + (string/= test-value "no")) + (push feature-keyword *features*))) + + (allow-features +unzip-bin+ :gempub-support) + + (allow-features +man-bin+ :man-bin)) (defmacro with-return-untranslated ((untranslated) &body body) `(handler-bind ((i18n-conditions:no-translation-table-error diff --git a/src/package.lisp b/src/package.lisp index 0204f0f..df0c8eb 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -35,6 +35,7 @@ :+openssl-bin+ :+xdg-open-bin+ :+unzip-bin+ + :+man-bin+ :_ :n_)) @@ -2500,6 +2501,7 @@ (:shadowing-import-from :misc :random-elt :shuffle) (:export :delete-message-status-marked-to-delete + :open-manual :quit-program :clean-close-program :notify diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index c13685a..dd2b3a3 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -20,6 +20,21 @@ (defun boolean-input-accepted-p (user-input) (string-equal user-input (_ "y"))) +(defun open-manual () + #+man-bin + (progn + (croatoan:end-screen) + (tui:with-notify-errors + (os-utils::run-external-program +man-bin+ + (list +program-name+) + :search t + :wait t + :input t + :output t + :error t))) + #-man-bin + (notify (_ "No manpage binary found on this system") :as-error t)) + (defun quit-program () "This is not the right function to quit the program, use 'clean-close-program'."