From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Llorens Newsgroups: gmane.lisp.guile.bugs Subject: bug#21147: readline history is stifled early so (readline-set! history-length nn) has no effect Date: Tue, 28 Jul 2015 10:06:06 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_BF99888D-6BC5-4EB5-861F-6FA5FA075136" X-Trace: ger.gmane.org 1438072708 7673 80.91.229.3 (28 Jul 2015 08:38:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Jul 2015 08:38:28 +0000 (UTC) To: 21147@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Jul 28 10:38:12 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZK0Oo-0006mP-7c for guile-bugs@m.gmane.org; Tue, 28 Jul 2015 10:38:10 +0200 Original-Received: from localhost ([::1]:57500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK0On-00010O-9r for guile-bugs@m.gmane.org; Tue, 28 Jul 2015 04:38:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK0Oj-00010F-R0 for bug-guile@gnu.org; Tue, 28 Jul 2015 04:38:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK0Og-0005jR-KL for bug-guile@gnu.org; Tue, 28 Jul 2015 04:38:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK0Og-0005jK-HI for bug-guile@gnu.org; Tue, 28 Jul 2015 04:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZK0Og-0003M5-3M for bug-guile@gnu.org; Tue, 28 Jul 2015 04:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Llorens Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 28 Jul 2015 08:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21147 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.143807264412848 (code B ref -1); Tue, 28 Jul 2015 08:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Jul 2015 08:37:24 +0000 Original-Received: from localhost ([127.0.0.1]:60658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZK0O3-0003LA-HP for submit@debbugs.gnu.org; Tue, 28 Jul 2015 04:37:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59374) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZK0O0-0003L1-Id for submit@debbugs.gnu.org; Tue, 28 Jul 2015 04:37:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK0Nz-0005HR-BM for submit@debbugs.gnu.org; Tue, 28 Jul 2015 04:37:20 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:34400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK0Nz-0005HD-8Z for submit@debbugs.gnu.org; Tue, 28 Jul 2015 04:37:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK0Ny-0000xb-Bm for bug-guile@gnu.org; Tue, 28 Jul 2015 04:37:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK0Nv-0005DX-1O for bug-guile@gnu.org; Tue, 28 Jul 2015 04:37:18 -0400 Original-Received: from zhbdzmsp-smta17.bluewin.ch ([195.186.99.133]:57398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK0Nu-0005Cf-NU for bug-guile@gnu.org; Tue, 28 Jul 2015 04:37:14 -0400 Original-Received: from [195.186.227.131] ([195.186.227.131:52044] helo=zhhdzmsp-smta14.bluewin.ch) by zhbdzmsp-smta17.bluewin.ch (envelope-from ) (ecelerity 3.5.10.45038 r(Core:3.5.10.0)) with ESMTP id 12/6F-24008-0F737B55; Tue, 28 Jul 2015 08:06:08 +0000 Original-Received: from 4box.hq.corp.viasat.com (62.2.203.131) by zhhdzmsp-smta14.bluewin.ch (8.5.142) (authenticated as dll@bluewin.ch) id 52330D9E2C46DF5B for bug-guile@gnu.org; Tue, 28 Jul 2015 08:06:08 +0000 X-Mailer: Apple Mail (2.1878.6) X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7818 Archived-At: --Apple-Mail=_BF99888D-6BC5-4EB5-861F-6FA5FA075136 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The default history-length is 200. When one imports (ice-9 readline), = history is stifled to this value, so it doesn't matter if you set = history-length to a larger value later on. I'm surprised that this has = gone unnoticed up to now, since 200 is really small. I may be missing = something... The patch changes scm_readline_options() so that history is only = stiffled when the options are actually set. This is rather clumsy since = it means that if one doesn't set the options, history will never be = stifled. An alternative would be to add an optional readline-options argument to = activate-readline. That way one would be able to increase history-length = before the first time history is stifled, and otherwise things would = work as they do now. Regards =09 Daniel --Apple-Mail=_BF99888D-6BC5-4EB5-861F-6FA5FA075136 Content-Disposition: attachment; filename=0001-Avoid-stifling-readline-history-when-looking-up-opti.patch Content-Type: application/octet-stream; name="0001-Avoid-stifling-readline-history-when-looking-up-opti.patch" Content-Transfer-Encoding: quoted-printable =46rom=2006397e42cd700690bdac0650e9e3cee9b6dfbcb4=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Llorens=20=0A= Date:=20Tue,=2028=20Jul=202015=2009:42:25=20+0200=0ASubject:=20[PATCH]=20= Avoid=20stifling=20readline=20history=20when=20looking=20up=20options=0A=0A= With=20this=20patch,=20history=20is=20never=20stifled=20unless=20= (readline-set!)=20is=20used.=0A=0A*=20src/guile-readline/readline.c=20= (scm_readline_options)=0A---=0A=20guile-readline/readline.c=20|=2056=20= ++++++++++++++++++++++++-----------------------=0A=201=20file=20changed,=20= 29=20insertions(+),=2027=20deletions(-)=0A=0Adiff=20--git=20= a/guile-readline/readline.c=20b/guile-readline/readline.c=0Aindex=20= aac6e18..a3e8903=20100644=0A---=20a/guile-readline/readline.c=0A+++=20= b/guile-readline/readline.c=0A@@=20-2,17=20+2,17=20@@=0A=20=0A=20/*=20= Copyright=20(C)=201997,1999,2000,2001,=202002,=202003,=202006,=202007,=20= 2008,=0A=20=20*=20=20=202009,=202010,=202013=20Free=20Software=20= Foundation,=20Inc.=0A-=20*=20=0A+=20*=0A=20=20*=20This=20program=20is=20= free=20software;=20you=20can=20redistribute=20it=20and/or=20modify=0A=20=20= *=20it=20under=20the=20terms=20of=20the=20GNU=20General=20Public=20= License=20as=20published=20by=0A=20=20*=20the=20Free=20Software=20= Foundation;=20either=20version=203,=20or=20(at=20your=20option)=0A=20=20= *=20any=20later=20version.=0A-=20*=20=0A+=20*=0A=20=20*=20This=20program=20= is=20distributed=20in=20the=20hope=20that=20it=20will=20be=20useful,=0A=20= =20*=20but=20WITHOUT=20ANY=20WARRANTY;=20without=20even=20the=20implied=20= warranty=20of=0A=20=20*=20MERCHANTABILITY=20or=20FITNESS=20FOR=20A=20= PARTICULAR=20PURPOSE.=20=20See=20the=0A=20=20*=20GNU=20General=20Public=20= License=20for=20more=20details.=0A-=20*=20=0A+=20*=0A=20=20*=20You=20= should=20have=20received=20a=20copy=20of=20the=20GNU=20General=20Public=20= License=0A=20=20*=20along=20with=20this=20software;=20see=20the=20file=20= COPYING.=20=20If=20not,=20write=20to=0A=20=20*=20the=20Free=20Software=20= Foundation,=20Inc.,=2051=20Franklin=20Street,=20Fifth=20Floor,=0A@@=20= -52,7=20+52,7=20@@=20scm_t_option=20scm_readline_opts[]=20=3D=20{=0A=20=0A= =20extern=20void=20stifle_history=20(int=20max);=0A=20=0A-SCM_DEFINE=20= (scm_readline_options,=20"readline-options-interface",=200,=201,=200,=20=0A= +SCM_DEFINE=20(scm_readline_options,=20"readline-options-interface",=20= 0,=201,=200,=0A=20=20=20=20=20=20=20=20=20=20=20=20=20(SCM=20setting),=0A= =20"")=0A=20#define=20FUNC_NAME=20s_scm_readline_options=0A@@=20-60,7=20= +60,9=20@@=20SCM_DEFINE=20(scm_readline_options,=20= "readline-options-interface",=200,=201,=200,=0A=20=20=20SCM=20ans=20=3D=20= scm_options=20(setting,=0A=20=09=09=09=20scm_readline_opts,=0A=20=09=09=09= =20FUNC_NAME);=0A-=20=20stifle_history=20(SCM_HISTORY_LENGTH);=0A+=20=20= if=20(!SCM_UNBNDP=20(setting))=20{=0A+=20=20=20=20stifle_history=20= (SCM_HISTORY_LENGTH);=0A+=20=20}=0A=20=20=20return=20ans;=0A=20}=0A=20= #undef=20FUNC_NAME=0A@@=20-107,13=20+109,13=20@@=20void=0A=20= rl_free_line_state=20()=0A=20{=0A=20=20=20register=20HIST_ENTRY=20= *entry;=0A-=20=20=20=0A+=0A=20=20=20free_undo_list=20();=0A=20=0A=20=20=20= entry=20=3D=20current_history=20();=0A=20=20=20if=20(entry)=0A-=20=20=20=20= entry->data=20=3D=20(char=20*)NULL;=20=0A-=20=20=0A+=20=20=20=20= entry->data=20=3D=20(char=20*)NULL;=0A+=0A=20=20=20_rl_kill_kbd_macro=20= ();=0A=20=20=20rl_clear_message=20();=0A=20=20=20_rl_init_argument=20();=0A= @@=20-145,15=20+147,15=20@@=20static=20void=20unwind_readline=20(void=20= *unused);=0A=20static=20void=20reentry_barrier=20(void);=0A=20=0A=20=0A= -SCM_DEFINE=20(scm_readline,=20"%readline",=200,=204,=200,=20=0A= +SCM_DEFINE=20(scm_readline,=20"%readline",=200,=204,=200,=0A=20=20=20=20= =20=20=20=20=20=20=20=20=20(SCM=20text,=20SCM=20inp,=20SCM=20outp,=20SCM=20= read_hook),=0A=20"")=0A=20#define=20FUNC_NAME=20s_scm_readline=0A=20{=0A=20= =20=20SCM=20ans;=0A-=20=20=0A+=0A=20=20=20reentry_barrier=20();=0A-=20=20= =0A+=0A=20=20=20before_read=20=3D=20SCM_BOOL_F;=0A=20=0A=20=20=20if=20= (!SCM_UNBNDP=20(text))=0A@@=20-164,7=20+166,7=20@@=20SCM_DEFINE=20= (scm_readline,=20"%readline",=200,=204,=200,=0A=20=09=20=20= scm_wrong_type_arg=20(s_scm_readline,=20SCM_ARG1,=20text);=0A=20=09}=0A=20= =20=20=20=20}=0A-=20=20=0A+=0A=20=20=20if=20(!((SCM_UNBNDP=20(inp)=20&&=20= SCM_OPINFPORTP=20(scm_current_input_port=20()))=0A=20=09||=20= SCM_OPINFPORTP=20(inp)))=0A=20=20=20=20=20{=0A@@=20-173,7=20+175,7=20@@=20= SCM_DEFINE=20(scm_readline,=20"%readline",=200,=204,=200,=0A=20=09=09=20=20= =20=20=20=20"Input=20port=20is=20not=20open=20or=20not=20a=20file=20= port",=0A=20=09=09=20=20=20=20=20=20SCM_EOL);=0A=20=20=20=20=20}=0A-=20=20= =0A+=0A=20=20=20if=20(!((SCM_UNBNDP=20(outp)=20&&=20SCM_OPOUTFPORTP=20= (scm_current_output_port=20()))=0A=20=09||=20SCM_OPOUTFPORTP=20(outp)))=0A= =20=20=20=20=20{=0A@@=20-197,7=20+199,7=20@@=20SCM_DEFINE=20= (scm_readline,=20"%readline",=200,=204,=200,=0A=20=0A=20=20=20= scm_dynwind_begin=20(0);=0A=20=20=20scm_dynwind_unwind_handler=20= (unwind_readline,=20NULL,=200);=0A-=20=20=0A+=0A=20=20=20ans=20=3D=20= internal_readline=20(text);=0A=20=0A=20=20=20scm_dynwind_end=20();=0A@@=20= -249,7=20+251,7=20@@=20internal_readline=20(SCM=20text)=0A=20=20=20s=20=3D= =20readline=20(prompt);=0A=20=20=20if=20(s)=0A=20=20=20=20=20ret=20=3D=20= scm_from_port_string=20(s,=20output_port);=0A-=20=20else=20=0A+=20=20= else=0A=20=20=20=20=20ret=20=3D=20SCM_EOF_VAL;=0A=20=0A=20=20=20if=20= (!SCM_UNBNDP=20(text))=0A@@=20-287,10=20+289,10=20@@=20= scm_readline_init_ports=20(SCM=20inp,=20SCM=20outp)=0A=20{=0A=20=20=20if=20= (SCM_UNBNDP=20(inp))=0A=20=20=20=20=20inp=20=3D=20scm_current_input_port=20= ();=0A-=20=20=0A+=0A=20=20=20if=20(SCM_UNBNDP=20(outp))=0A=20=20=20=20=20= outp=20=3D=20scm_current_output_port=20();=0A-=20=20=0A+=0A=20=20=20if=20= (!SCM_OPINFPORTP=20(inp))=20{=0A=20=20=20=20=20scm_misc_error=20(0,=0A=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"Input=20= port=20is=20not=20open=20or=20not=20a=20file=20port",=0A@@=20-311,7=20= +313,7=20@@=20scm_readline_init_ports=20(SCM=20inp,=20SCM=20outp)=0A=20=0A= =20=0A=20=0A-SCM_DEFINE=20(scm_add_history,=20"add-history",=201,=200,=20= 0,=20=0A+SCM_DEFINE=20(scm_add_history,=20"add-history",=201,=200,=200,=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20(SCM=20text),=0A=20"")=0A=20= #define=20FUNC_NAME=20s_scm_add_history=0A@@=20-327,7=20+329,7=20@@=20= SCM_DEFINE=20(scm_add_history,=20"add-history",=201,=200,=200,=0A=20= #undef=20FUNC_NAME=0A=20=0A=20=0A-SCM_DEFINE=20(scm_read_history,=20= "read-history",=201,=200,=200,=20=0A+SCM_DEFINE=20(scm_read_history,=20= "read-history",=201,=200,=200,=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= (SCM=20file),=0A=20"")=0A=20#define=20FUNC_NAME=20s_scm_read_history=0A= @@=20-343,7=20+345,7=20@@=20SCM_DEFINE=20(scm_read_history,=20= "read-history",=201,=200,=200,=0A=20#undef=20FUNC_NAME=0A=20=0A=20=0A= -SCM_DEFINE=20(scm_write_history,=20"write-history",=201,=200,=200,=20=0A= +SCM_DEFINE=20(scm_write_history,=20"write-history",=201,=200,=200,=0A=20= =20=20=20=20=20=20=20=20=20=20=20=20(SCM=20file),=0A=20"")=0A=20#define=20= FUNC_NAME=20s_scm_write_history=0A@@=20-358,7=20+360,7=20@@=20SCM_DEFINE=20= (scm_write_history,=20"write-history",=201,=200,=200,=0A=20}=0A=20#undef=20= FUNC_NAME=0A=20=0A-SCM_DEFINE=20(scm_clear_history,=20"clear-history",=20= 0,=200,=200,=20=0A+SCM_DEFINE=20(scm_clear_history,=20"clear-history",=20= 0,=200,=200,=0A=20=20=20=20=20=20=20=20=20=20=20=20=20(),=0A=20=09=20=20=20= =20"Clear=20the=20history=20buffer=20of=20the=20readline=20machinery.")=0A= =20#define=20FUNC_NAME=20s_scm_clear_history=0A@@=20-369,7=20+371,7=20@@=20= SCM_DEFINE=20(scm_clear_history,=20"clear-history",=200,=200,=200,=0A=20= #undef=20FUNC_NAME=0A=20=0A=20=0A-SCM_DEFINE=20= (scm_filename_completion_function,=20"filename-completion-function",=20= 2,=200,=200,=20=0A+SCM_DEFINE=20(scm_filename_completion_function,=20= "filename-completion-function",=202,=200,=200,=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20(SCM=20text,=20SCM=20continuep),=0A=20"")=0A=20#define=20= FUNC_NAME=20s_scm_filename_completion_function=0A@@=20-408,10=20+410,10=20= @@=20completion_function=20(char=20*text,=20int=20continuep)=0A=20=20=20=20= =20=20=20SCM=20t=20=3D=20scm_from_locale_string=20(text);=0A=20=20=20=20=20= =20=20SCM=20c=20=3D=20scm_from_bool=20(continuep);=0A=20=20=20=20=20=20=20= res=20=3D=20scm_apply=20(compfunc,=20scm_list_2=20(t,=20c),=20SCM_EOL);=0A= -=20=20=0A+=0A=20=20=20=20=20=20=20if=20(scm_is_false=20(res))=0A=20=09= return=20NULL;=0A-=20=20=0A+=0A=20=20=20=20=20=20=20return=20= scm_to_locale_string=20(res);=0A=20=20=20=20=20}=0A=20}=0A@@=20-525,7=20= +527,7=20@@=20scm_init_readline=20()=0A=20=20=20rl_getc_function=20=3D=20= current_input_getc;=0A=20#if=20defined=20(_RL_FUNCTION_TYPEDEF)=0A=20=20=20= rl_completion_entry_function=20=3D=20(rl_compentry_func_t*)=20= completion_function;=0A-#else=20=20=0A+#else=0A=20=20=20= rl_completion_entry_function=20=3D=20(Function*)=20completion_function;=0A= =20#endif=0A=20=20=20rl_basic_word_break_characters=20=3D=20"=20= \t\n\"'`;()";=0A@@=20-535,12=20+537,12=20@@=20scm_init_readline=20()=0A=20= #if=20defined=20(HAVE_DECL_RL_CATCH_SIGNALS)=20&&=20= HAVE_DECL_RL_CATCH_SIGNALS=0A=20=20=20rl_catch_signals=20=3D=200;=0A=20= #endif=0A-=20=20=0A+=0A=20=20=20/*=20But=20let=20readline=20handle=20= SIGWINCH.=20*/=0A=20#if=20defined=20(HAVE_DECL_RL_CATCH_SIGWINCH)=20&&=20= HAVE_DECL_RL_CATCH_SIGWINCH=0A=20=20=20rl_catch_sigwinch=20=3D=201;=0A=20= #endif=0A-=20=20=0A+=0A=20=20=20reentry_barrier_mutex=20=3D=20= scm_make_mutex=20();=0A=20=20=20scm_init_opts=20(scm_readline_options,=0A= =20=09=09=20scm_readline_opts);=0A--=20=0A2.4.6=0A=0A= --Apple-Mail=_BF99888D-6BC5-4EB5-861F-6FA5FA075136--