| Maths on Thu, 18 Dec 1997 14:51:56 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: update 2.0.2.alpha |
Dear Karim,
I think I have discovered the problem with gp under emacs under linux
which Kevin Buzzard had. It only started happening for me when I
reinstalled the patched version 2.0.2alpha. The problem comes from
the following code for the function do_prompt in gp.c:
static char *
do_prompt()
{
#ifdef UNIX /* This is probably standard Ansi C. */
static char promptbuf[128];
char *s = promptbuf;
time_t t = time(NULL);
/* escape sequences bug readline, so use special bracing if available
* (cf readline.h). Otherwise, first check if relevant colours disabled,
* then hope for the best...
*/
if (gp_colors[c_PROMPT] == c_NONE && gp_colors[c_INPUT] == c_NONE)
strftime(s,79,prompt,localtime(&t));
else
{
# ifdef RL_PROMPT_START_IGNORE
sprintf(s,"%c%s%c", RL_PROMPT_START_IGNORE,
term_get_color(c_PROMPT),
RL_PROMPT_END_IGNORE);
# else
strcpy(s, term_get_color(c_PROMPT));
# endif
(etc etc)
The macros RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE are
defined in readline.h. They are inserted before and after the escape
sequences which switch colors. Under emacs (under linux) these
display in the emacs buffer as ^A and ^B (I think they are '\001' and
'\002'). This stops the cope in pari.el from finding the prompt
properly. I solved the problem by commenting out the line in .gprc
which defines the colors. I suggest that the color setting is turned
off altogether when gp is called with the -emacs switch, probably by
patching the function setdcolors.
--
John Cremona
University of Exeter
Department of Mathematics
North Park Road
Exeter EX4 4QE
UK
Tel.: +44-1392-263974 (Office)
+44-1392-210758 (Home)
Fax: +44-1392-263997
email: cremona@maths.exeter.ac.uk