poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] pk-repl: inform the inputrc parser of the program name


From: Jose E. Marchesi
Subject: Re: [PATCH v2] pk-repl: inform the inputrc parser of the program name
Date: Wed, 19 Oct 2022 13:00:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> This allows users to conditionally adjust their readline preferences
> based on whether they're using poke.
>
> 2022-04-08  Arsen Arsenović  <arsen@aarsen.me>
>
>       * poke/pk-repl.c: Set rl_readline_name to "gnupoke", to inform
>       the inputrc parser about who we are.
>       * configure.ac: Detect whether our readline has
>       rl_readline_name.
> ---
> Hi Jose,
>
> On Tuesday, 18 October 2022 19:08:58 CEST Jose E. Marchesi wrote:
>> If a suitable libreadline is not found by configure, then a
>> replacement dummy version of the library from gnulib is used.  We
>> need to make sure that the `readline' gnulib module actually provides
>> rl_readline_name.
> Without a full readline, I get an error from configure.ac:
>
>     if test "x$gl_cv_lib_readline" = "xno"; then
>        AC_MSG_ERROR([can't find an usable libreadline.  Please install one.])
>     fi
>
> ... and I didn't realize gnulib can provide readline at all, but indeed, your
> suspicion that it lacks this is well-placed, I can't find any such variable.

Hmm, according to commit ca232c60d9a79c6b82ff3fd095198470a7f6164f at
some point we started actually requiring a reall full-fledged readline:

commit ca232c60d9a79c6b82ff3fd095198470a7f6164fh
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Sat Nov 9 01:40:38 2019 +0100

    build: require GNU readline
    
    2019-11-09  Jose E. Marchesi  <jemarch@gnu.org>
    
            * configure.ac: Make libreadline a hard requirement.
            * HACKING (readline): Document that now a full implementation of
            readline is required.

I don't actually remember why, but there must be a reason for that.
So the patch is OK for master.

Thanks!

[If you don't have write access to the git repository, please let me
 know what your username in savannah is and I will add you to the
 corresponding group.]

>
>> I think the application name should be either "poke" or "gnupoke". 
>> Poke with big-p is the name of the language :)
> Ah, right, my bad.  I was still in the frame of conventions bash imposed by
> setting rl_readline_name = "Bash".
>
> Presuming that the proper libreadline check above is either an oversight or
> some confusion, here's a v2 that addresses that issue, if not, dropping those
> bits and applying should do okay.
>
>  configure.ac   | 7 +++++++
>  poke/pk-repl.c | 5 +++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 4088c2d7..d077a1ed 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -217,6 +217,13 @@ dnl The test framework is optional.
>  AC_CHECK_HEADERS([dejagnu.h])
>  AM_CONDITIONAL([HAVE_DEJAGNU], [test "$ac_cv_header_dejagnu_h" = yes])
>  
> +dnl Some readline versions don't provide this symbol.
> +AC_CHECK_DECLS([rl_readline_name], [], [], [[
> +/* Readline forgets to include this.  */
> +#include <stdio.h>
> +#include <readline/readline.h>
> +]])
> +
>  dnl editor syntax definitions
>  AC_ARG_WITH([vimdir],
>   [AS_HELP_STRING([--with-vimdir],
> diff --git a/poke/pk-repl.c b/poke/pk-repl.c
> index 351a04ac..716f6d84 100644
> --- a/poke/pk-repl.c
> +++ b/poke/pk-repl.c
> @@ -329,6 +329,11 @@ pk_repl (void)
>    rl_completer_quote_characters = "\"";
>    rl_completer_word_break_characters = " \t\n\"\\`@$><=;|&{("; /* }) */
>  
> +  /* Let the inputrc parser know who we are.  */
> +#if HAVE_DECL_RL_READLINE_NAME
> +  rl_readline_name = "gnupoke";
> +#endif
> +
>    /* Arrange for the current line to be cancelled on SIGINT.
>       Since some library code is also interested in SIGINT
>       (GNU libtextstyle, via gnulib module fatal-signal), it is better



reply via email to

[Prev in Thread] Current Thread [Next in Thread]