guile-user
[Top][All Lists]
Advanced

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

Re: How to flush history ?


From: Neil Jerram
Subject: Re: How to flush history ?
Date: Wed, 26 Aug 2009 22:38:40 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Roberto Rosetti <address@hidden> 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





reply via email to

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