From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: How to flush history ? Date: Wed, 26 Aug 2009 22:38:40 +0100 Message-ID: <87tyzuntlr.fsf@arudy.ossau.uklinux.net> References: <1249204942.25578.5.camel@ubuntu> <87ws56yt04.fsf@arudy.ossau.uklinux.net> <1250355695.27999.10.camel@ubuntu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251322812 6852 80.91.229.12 (26 Aug 2009 21:40:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Aug 2009 21:40:12 +0000 (UTC) Cc: guile-user ML To: rob.rosetti@gmail.com Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Aug 26 23:40:05 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MgQDr-0002Dy-10 for guile-user@m.gmane.org; Wed, 26 Aug 2009 23:40:03 +0200 Original-Received: from localhost ([127.0.0.1]:49891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgQDp-0006oV-Em for guile-user@m.gmane.org; Wed, 26 Aug 2009 17:40:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgQCf-0005fi-GI for guile-user@gnu.org; Wed, 26 Aug 2009 17:38:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgQCb-0005bm-4x for guile-user@gnu.org; Wed, 26 Aug 2009 17:38:49 -0400 Original-Received: from [199.232.76.173] (port=40463 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgQCa-0005bZ-Iu for guile-user@gnu.org; Wed, 26 Aug 2009 17:38:44 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:57235) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MgQCY-00033a-EQ for guile-user@gnu.org; Wed, 26 Aug 2009 17:38:42 -0400 Original-Received: from arudy (host86-152-99-133.range86-152.btcentralplus.com [86.152.99.133]) by mail3.uklinux.net (Postfix) with ESMTP id ACAC91F691C; Wed, 26 Aug 2009 22:38:41 +0100 (BST) Original-Received: from arudy.ossau.uklinux.net (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id E5D9838021; Wed, 26 Aug 2009 22:38:40 +0100 (BST) In-Reply-To: <1250355695.27999.10.camel@ubuntu> (Roberto Rosetti's message of "Sat\, 15 Aug 2009 19\:01\:35 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7421 Archived-At: Roberto Rosetti writes: > Well, thanks for the answer Neil. I know about the existence of > ~/.guile_history, but my problem is more complex: I need a hook to the > history buffer, like a port or something. A way to flush the history to > its file at a given command. Just to grab everything written before and > then manipulate (a copy of) the history file. > For the moment, I've written a simple wrapper for readline, that process > the input and save every command to a specific text file, after checking > it for correctness. Well I wasn't aware of it before, but I just looked at guile-readline/readline.c and noticed that there is a write-history primitive: SCM_DEFINE (scm_write_history, "write-history", 1, 0, 0, (SCM file), "") #define FUNC_NAME s_scm_write_history { char *filename; SCM ret; filename = scm_to_locale_string (file); ret = scm_from_bool (!write_history (filename)); free (filename); return ret; } #undef FUNC_NAME Is that a solution for you? Regards, Neil