/[qemacs]/qemacs/qe.c
ViewVC logotype

Diff of /qemacs/qe.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by chqrlie, Tue May 10 20:56:42 2005 UTC revision 1.22 by chqrlie, Wed May 11 15:51:53 2005 UTC
# Line 313  void qe_register_binding(int key, const Line 313  void qe_register_binding(int key, const
313          qe_register_binding2(key, d, NULL);          qe_register_binding2(key, d, NULL);
314      } else {      } else {
315          p = mode_names;          p = mode_names;
316          for(;;) {          for (;;) {
317              r = strchr(p, '|');              r = strchr(p, '|');
318              /* XXX: overflows */              /* XXX: overflows */
319              if (!r) {              if (!r) {
# Line 403  void text_move_bol(EditState *s) Line 403  void text_move_bol(EditState *s)
403  {  {
404      int c, offset1;      int c, offset1;
405    
406      for(;;) {      for (;;) {
407          if (s->offset <= 0)          if (s->offset <= 0)
408              break;              break;
409          c = eb_prevc(s->b, s->offset, &offset1);          c = eb_prevc(s->b, s->offset, &offset1);
# Line 417  void text_move_eol(EditState *s) Line 417  void text_move_eol(EditState *s)
417  {  {
418      int c, offset1;      int c, offset1;
419    
420      for(;;) {      for (;;) {
421          c = eb_nextc(s->b, s->offset, &offset1);          c = eb_nextc(s->b, s->offset, &offset1);
422          if (c == '\n')          if (c == '\n')
423              break;              break;
# Line 438  static void word_right(EditState *s, int Line 438  static void word_right(EditState *s, int
438  {  {
439      int c, offset1;      int c, offset1;
440    
441      for(;;) {      for (;;) {
442          if (s->offset >= s->b->total_size)          if (s->offset >= s->b->total_size)
443              break;              break;
444          c = eb_nextc(s->b, s->offset, &offset1);          c = eb_nextc(s->b, s->offset, &offset1);
# Line 452  static void word_left(EditState *s, int Line 452  static void word_left(EditState *s, int
452  {  {
453      int c, offset1;      int c, offset1;
454    
455      for(;;) {      for (;;) {
456          if (s->offset == 0)          if (s->offset == 0)
457              break;              break;
458          c = eb_prevc(s->b, s->offset, &offset1);          c = eb_prevc(s->b, s->offset, &offset1);
# Line 482  int eb_next_paragraph(EditBuffer *b, int Line 482  int eb_next_paragraph(EditBuffer *b, int
482      offset = eb_goto_bol(b, offset);      offset = eb_goto_bol(b, offset);
483      /* find end of paragraph */      /* find end of paragraph */
484      text_found = 0;      text_found = 0;
485      for(;;) {      for (;;) {
486          if (offset >= b->total_size)          if (offset >= b->total_size)
487              break;              break;
488          if (eb_is_empty_line(b, offset)) {          if (eb_is_empty_line(b, offset)) {
# Line 498  int eb_next_paragraph(EditBuffer *b, int Line 498  int eb_next_paragraph(EditBuffer *b, int
498    
499  int eb_start_paragraph(EditBuffer *b, int offset)  int eb_start_paragraph(EditBuffer *b, int offset)
500  {  {
501      for(;;) {      for (;;) {
502          offset = eb_goto_bol(b, offset);          offset = eb_goto_bol(b, offset);
503          if (offset <= 0)          if (offset <= 0)
504              break;              break;
# Line 518  void do_backward_paragraph(EditState *s) Line 518  void do_backward_paragraph(EditState *s)
518    
519      offset = s->offset;      offset = s->offset;
520      /* skip empty lines */      /* skip empty lines */
521      for(;;) {      for (;;) {
522          if (offset <= 0)          if (offset <= 0)
523              break;              break;
524          offset = eb_goto_bol(s->b, offset);          offset = eb_goto_bol(s->b, offset);
# Line 607  void do_fill_paragraph(EditState *s) Line 607  void do_fill_paragraph(EditState *s)
607                  if (offset < par_end) {                  if (offset < par_end) {
608                      /* indent */                      /* indent */
609                      buf[0] = ' ';                      buf[0] = ' ';
610                      for(n = indent_size; n > 0; n--)                      for (n = indent_size; n > 0; n--)
611                          eb_insert(s->b, chunk_start, buf, 1);                          eb_insert(s->b, chunk_start, buf, 1);
612                      chunk_start += indent_size;                      chunk_start += indent_size;
613    
# Line 664  void do_changecase_word(EditState *s, in Line 664  void do_changecase_word(EditState *s, in
664      int c;      int c;
665            
666      word_right(s, 1);      word_right(s, 1);
667      for(;;) {      for (;;) {
668          if (s->offset >= s->b->total_size)          if (s->offset >= s->b->total_size)
669              break;              break;
670          c = eb_nextc(s->b, s->offset, NULL);          c = eb_nextc(s->b, s->offset, NULL);
# Line 684  void do_changecase_region(EditState *s, Line 684  void do_changecase_region(EditState *s,
684          offset = s->b->mark;          offset = s->b->mark;
685      else      else
686          offset = s->offset;          offset = s->offset;
687      for(;;) {      for (;;) {
688          if (s->offset > s->b->mark) {          if (s->offset > s->b->mark) {
689              if (offset >= s->offset)              if (offset >= s->offset)
690                  break;                  break;
# Line 780  void get_cursor_pos(EditState *s, Cursor Line 780  void get_cursor_pos(EditState *s, Cursor
780      display_init(ds, s, DISP_CURSOR);      display_init(ds, s, DISP_CURSOR);
781      ds->cursor_opaque = m;      ds->cursor_opaque = m;
782      ds->cursor_func = cursor_func;      ds->cursor_func = cursor_func;
783        memset(m, 0, sizeof(*m));
784      m->offsetc = s->offset;      m->offsetc = s->offset;
785      m->xc = m->yc = NO_CURSOR;      m->xc = m->yc = NO_CURSOR;
786      display1(ds);      display1(ds);
# Line 1050  void text_move_left_right_visual(EditSta Line 1051  void text_move_left_right_visual(EditSta
1051      yc = cm.linec;      yc = cm.linec;
1052    
1053      nextline = 0;      nextline = 0;
1054      for(;;) {      for (;;) {
1055          /* find cursor offset */          /* find cursor offset */
1056          m->yd = yc;          m->yd = yc;
1057          if (!nextline) {          if (!nextline) {
# Line 1215  void text_write_char(EditState *s, int k Line 1216  void text_write_char(EditState *s, int k
1216    
1217          s->compose_buf[s->compose_len++] = key;          s->compose_buf[s->compose_len++] = key;
1218          m = s->input_method;          m = s->input_method;
1219          for(;;) {          for (;;) {
1220              if (!m) {              if (!m) {
1221                  s->compose_len = 0;                  s->compose_len = 0;
1222                  break;                  break;
# Line 1236  void text_write_char(EditState *s, int k Line 1237  void text_write_char(EditState *s, int k
1237                  offset = s->compose_start_offset;                  offset = s->compose_start_offset;
1238                  offset1 = s->offset; /* save offset so that we are not disturb                  offset1 = s->offset; /* save offset so that we are not disturb
1239                                          when it moves in eb_delete() */                                          when it moves in eb_delete() */
1240                  for(i=0;i<match_len;i++)                  for (i = 0; i < match_len; i++)
1241                      eb_nextc(s->b, offset, &offset);                      eb_nextc(s->b, offset, &offset);
1242                  eb_delete(s->b, s->compose_start_offset,                  eb_delete(s->b, s->compose_start_offset,
1243                            offset - s->compose_start_offset);                            offset - s->compose_start_offset);
# Line 1498  static void do_set_mode_file(EditState * Line 1499  static void do_set_mode_file(EditState *
1499          /* try to remove the raw or mode specific data if it is no          /* try to remove the raw or mode specific data if it is no
1500             longer used. */             longer used. */
1501          data_count = 0;          data_count = 0;
1502          for(e = s->qe_state->first_window; e != NULL; e = e->next_window) {          for (e = s->qe_state->first_window; e != NULL; e = e->next_window) {
1503              if (e != s && e->b == b) {              if (e != s && e->b == b) {
1504                  if (e->mode->data_type != &raw_data_type)                  if (e->mode->data_type != &raw_data_type)
1505                      data_count++;                      data_count++;
# Line 1584  void charset_completion(StringArray *cs, Line 1585  void charset_completion(StringArray *cs,
1585      int len;      int len;
1586    
1587      len = strlen(charset_str);      len = strlen(charset_str);
1588      for(p = first_charset; p != NULL; p = p->next) {      for (p = first_charset; p != NULL; p = p->next) {
1589          if (!strncmp(p->name, charset_str, len))          if (!strncmp(p->name, charset_str, len))
1590              add_string(cs, p->name);              add_string(cs, p->name);
1591      }      }
# Line 1629  void do_convert_buffer_file_coding_syste Line 1630  void do_convert_buffer_file_coding_syste
1630    
1631      /* well, not very fast, but simple */      /* well, not very fast, but simple */
1632      b = s->b;      b = s->b;
1633      for(offset = 0; offset < b->total_size;) {      for (offset = 0; offset < b->total_size;) {
1634          c = eb_nextc(b, offset, &offset);          c = eb_nextc(b, offset, &offset);
1635          len = unicode_to_charset(buf, c, charset);          len = unicode_to_charset(buf, c, charset);
1636          eb_write(b1, b1->total_size, buf, len);          eb_write(b1, b1->total_size, buf, len);
# Line 1926  QEStyleDef *find_style(const char *name) Line 1927  QEStyleDef *find_style(const char *name)
1927      int i;      int i;
1928      QEStyleDef *style;      QEStyleDef *style;
1929    
1930      for(i=0;i<QE_STYLE_NB;i++) {      for (i = 0; i < QE_STYLE_NB; i++) {
1931          style = &qe_styles[i];          style = &qe_styles[i];
1932          if (!strcmp(style->name, name))          if (!strcmp(style->name, name))
1933              return style;              return style;
# Line 1940  void style_completion(StringArray *cs, c Line 1941  void style_completion(StringArray *cs, c
1941      int len, i;      int len, i;
1942    
1943      len = strlen(input);      len = strlen(input);
1944      for(i=0;i<QE_STYLE_NB;i++) {      for (i = 0; i < QE_STYLE_NB; i++) {
1945          style = &qe_styles[i];          style = &qe_styles[i];
1946          if (!strncmp(style->name, input, len))          if (!strncmp(style->name, input, len))
1947              add_string(cs, style->name);              add_string(cs, style->name);
# Line 1972  void do_set_style(EditState *e, const ch Line 1973  void do_set_style(EditState *e, const ch
1973          put_status(e, "Unknown property '%s'", propstr);          put_status(e, "Unknown property '%s'", propstr);
1974          return;          return;
1975      }      }
1976      switch(prop_index) {      switch (prop_index) {
1977      case 0:      case 0:
1978          if (css_get_color(&style->fg_color, value))          if (css_get_color(&style->fg_color, value))
1979              goto bad_color;              goto bad_color;
# Line 2161  static void flush_line(DisplayState *s, Line 2162  static void flush_line(DisplayState *s,
2162      /* compute baseline and lineheight */      /* compute baseline and lineheight */
2163      baseline = 0;      baseline = 0;
2164      max_descent = 0;      max_descent = 0;
2165      for(i=0;i<nb_fragments;i++) {      for (i = 0; i < nb_fragments; i++) {
2166          if (fragments[i].ascent > baseline)          if (fragments[i].ascent > baseline)
2167              baseline = fragments[i].ascent;              baseline = fragments[i].ascent;
2168          if (fragments[i].descent > max_descent)          if (fragments[i].descent > max_descent)
# Line 2180  static void flush_line(DisplayState *s, Line 2181  static void flush_line(DisplayState *s,
2181          while (pos < nb_fragments) {          while (pos < nb_fragments) {
2182              if (fragments[pos].embedding_level >= level) {              if (fragments[pos].embedding_level >= level) {
2183                  /* find all chars >= level */                  /* find all chars >= level */
2184                  for(p = pos + 1; p < nb_fragments && fragments[p].embedding_level >= level; p++);                  for (p = pos + 1; p < nb_fragments && fragments[p].embedding_level >= level; p++);
2185                  reverse_fragments(fragments + pos, p - pos);                  reverse_fragments(fragments + pos, p - pos);
2186                  pos = p + 1;                  pos = p + 1;
2187              } else {              } else {
# Line 2248  static void flush_line(DisplayState *s, Line 2249  static void flush_line(DisplayState *s,
2249                                 default_style.bg_color);                                 default_style.bg_color);
2250              }              }
2251              x += x_start;              x += x_start;
2252              for(i=0;i<nb_fragments;i++) {              for (i = 0; i < nb_fragments; i++) {
2253                  frag = &fragments[i];                  frag = &fragments[i];
2254                  get_style(e, &style, frag->style);                  get_style(e, &style, frag->style);
2255                  fill_rectangle(screen, x, y, frag->width, line_height,                  fill_rectangle(screen, x, y, frag->width, line_height,
# Line 2278  static void flush_line(DisplayState *s, Line 2279  static void flush_line(DisplayState *s,
2279                  }                  }
2280              }              }
2281              x += x_start;              x += x_start;
2282              for(i=0;i<nb_fragments;i++) {              for (i = 0; i < nb_fragments; i++) {
2283                  frag = &fragments[i];                  frag = &fragments[i];
2284                  get_style(e, &style, frag->style);                  get_style(e, &style, frag->style);
2285                  font = select_font(screen,                  font = select_font(screen,
# Line 2319  static void flush_line(DisplayState *s, Line 2320  static void flush_line(DisplayState *s,
2320              s->eod = 1;              s->eod = 1;
2321          }          }
2322    
2323          for(i=0;i<nb_fragments;i++) {          for (i = 0; i < nb_fragments; i++) {
2324              int w, k, j, offset1, offset2;              int w, k, j, offset1, offset2;
2325    
2326              frag = &fragments[i];              frag = &fragments[i];
2327    
2328              j = frag->line_index;              j = frag->line_index;
2329              for(k=0;k<frag->len;k++) {              for (k = 0; k < frag->len; k++) {
2330                  int hex_mode;                  int hex_mode;
2331                  offset1 = s->line_offsets[j][0];                  offset1 = s->line_offsets[j][0];
2332                  offset2 = s->line_offsets[j][1];                  offset2 = s->line_offsets[j][1];
# Line 2402  static void flush_fragment(DisplayState Line 2403  static void flush_fragment(DisplayState
2403    
2404      /* convert fragment to glyphs (currently font independent, but may      /* convert fragment to glyphs (currently font independent, but may
2405         change) */         change) */
2406      dst_max_size = MAX_SCREEN_WIDTH - s->line_index;      //dst_max_size = MAX_SCREEN_WIDTH - s->line_index;
2407      if (dst_max_size <= 0)      //if (dst_max_size <= 0)
2408          goto the_end;      //    goto the_end;
2409        dst_max_size = MAX_WORD_SIZE; // assumming s->fragment_index MAX_WORD_SIZE
2410      nb_glyphs = unicode_to_glyphs(s->line_chars + s->line_index,      nb_glyphs = unicode_to_glyphs(s->line_chars + s->line_index,
2411                                    char_to_glyph_pos, dst_max_size,                                    char_to_glyph_pos, dst_max_size,
2412                                    s->fragment_chars, s->fragment_index,                                    s->fragment_chars, s->fragment_index,
# Line 2453  static void flush_fragment(DisplayState Line 2455  static void flush_fragment(DisplayState
2455      } else {      } else {
2456          /* XXX: use text metrics for full fragment */          /* XXX: use text metrics for full fragment */
2457          w = 0;          w = 0;
2458          for(i=0;i<nb_glyphs;i++) {          for (i = 0; i < nb_glyphs; i++) {
2459              QECharMetrics metrics;              QECharMetrics metrics;
2460              text_metrics(screen, font, &metrics, &s->line_chars[j], 1);              text_metrics(screen, font, &metrics, &s->line_chars[j], 1);
2461              if (metrics.font_ascent > ascent)              if (metrics.font_ascent > ascent)
# Line 2480  static void flush_fragment(DisplayState Line 2482  static void flush_fragment(DisplayState
2482      s->line_index += nb_glyphs;      s->line_index += nb_glyphs;
2483      s->x += frag->width;      s->x += frag->width;
2484    
2485      switch(s->wrap) {      switch (s->wrap) {
2486      case WRAP_TRUNCATE:      case WRAP_TRUNCATE:
2487          break;          break;
2488      case WRAP_LINE:      case WRAP_LINE:
# Line 2539  static void flush_fragment(DisplayState Line 2541  static void flush_fragment(DisplayState
2541                      (s->nb_fragments - s->word_index) * sizeof(TextFragment));                      (s->nb_fragments - s->word_index) * sizeof(TextFragment));
2542              s->nb_fragments -= s->word_index;              s->nb_fragments -= s->word_index;
2543              s->x = 0;              s->x = 0;
2544              for(i=0;i<s->nb_fragments;i++) {              for (i = 0; i < s->nb_fragments; i++) {
2545                  s->fragments[i].line_index -= index;                  s->fragments[i].line_index -= index;
2546                  s->x += s->fragments[i].width;                  s->x += s->fragments[i].width;
2547              }              }
# Line 2666  static void display1(DisplayState *s) Line 2668  static void display1(DisplayState *s)
2668    
2669      s->eod = 0;      s->eod = 0;
2670      offset = e->offset_top;      offset = e->offset_top;
2671      for(;;) {      for (;;) {
2672          offset = e->mode->text_display(e, s, offset);          offset = e->mode->text_display(e, s, offset);
2673          /* EOF reached ? */          /* EOF reached ? */
2674          if (offset < 0)          if (offset < 0)
2675              break;              break;
2676                    
2677          switch(s->do_disp) {          switch (s->do_disp) {
2678          case DISP_CURSOR:          case DISP_CURSOR:
2679              if (s->eod)              if (s->eod)
2680                  return;                  return;
# Line 2719  static int bidir_compute_attributes(Type Line 2721  static int bidir_compute_attributes(Type
2721    
2722      ltype = FRIBIDI_TYPE_SOT;      ltype = FRIBIDI_TYPE_SOT;
2723    
2724      for(;;) {      for (;;) {
2725          offset1 = offset;          offset1 = offset;
2726          c = eb_nextc(b, offset, &offset);          c = eb_nextc(b, offset, &offset);
2727          if (c == '\n')          if (c == '\n')
# Line 2793  int get_colorized_line(EditState *s, uns Line 2795  int get_colorized_line(EditState *s, uns
2795          offset = eb_goto_pos(s->b, s->colorize_nb_valid_lines - 1, 0);          offset = eb_goto_pos(s->b, s->colorize_nb_valid_lines - 1, 0);
2796          colorize_state = s->colorize_states[s->colorize_nb_valid_lines - 1];          colorize_state = s->colorize_states[s->colorize_nb_valid_lines - 1];
2797    
2798          for(l = s->colorize_nb_valid_lines; l <= line_num; l++) {          for (l = s->colorize_nb_valid_lines; l <= line_num; l++) {
2799              len = eb_get_line(s->b, buf, buf_size - 1, &offset);              len = eb_get_line(s->b, buf, buf_size - 1, &offset);
2800              buf[len] = '\n';              buf[len] = '\n';
2801    
# Line 2927  int text_display(EditState *s, DisplaySt Line 2929  int text_display(EditState *s, DisplaySt
2929            
2930      bd = embeds + 1;      bd = embeds + 1;
2931      char_index = 0;      char_index = 0;
2932      for(;;) {      for (;;) {
2933          offset0 = offset;          offset0 = offset;
2934          if (offset >= s->b->total_size) {          if (offset >= s->b->total_size) {
2935              display_eol(ds, offset0, offset0 + 1);              display_eol(ds, offset0, offset0 + 1);
# Line 2990  void generic_text_display(EditState *s) Line 2992  void generic_text_display(EditState *s)
2992      display_init(ds, s, DISP_CURSOR_SCREEN);      display_init(ds, s, DISP_CURSOR_SCREEN);
2993      ds->cursor_opaque = m;      ds->cursor_opaque = m;
2994      ds->cursor_func = cursor_func;      ds->cursor_func = cursor_func;
2995        memset(m, 0, sizeof(*m));
2996      m->offsetc = s->offset;      m->offsetc = s->offset;
2997      m->xc = m->yc = NO_CURSOR;      m->xc = m->yc = NO_CURSOR;
2998      offset = s->offset_top;      offset = s->offset_top;
2999      for(;;) {      for (;;) {
3000          if (ds->y <= 0) {          if (ds->y <= 0) {
3001              s->offset_top = offset;              s->offset_top = offset;
3002              s->y_disp = ds->y;              s->y_disp = ds->y;
# Line 3116  enum CmdArgType { Line 3119  enum CmdArgType {
3119  #define MAX_CMD_ARGS 5  #define MAX_CMD_ARGS 5
3120    
3121  /* XXX: potentially non portable on weird architectures */  /* XXX: potentially non portable on weird architectures */
3122    /* Minimum assumptions are:
3123       - sizeof(int) == sizeof(void*) == sizeof(char*)
3124       - arguments are passed the same way for all above types
3125       - arguments are passed the same way for prototyped and
3126         unprototyped functions
3127       These assumptions could be lifted by constructing an
3128       argument list signature in parse_args() and switch here
3129       to the correct prototype invocation.
3130       So far 144 qemacs commands have these signatures:
3131       - void (*)(EditState *); (68)
3132       - void (*)(EditState *, int); (35)
3133       - void (*)(EditState *, int, int); (2)
3134       - void (*)(EditState *, const char *); (19)
3135       - void (*)(EditState *, const char *, int); (2)
3136       - void (*)(EditState *, const char *, const char *); (6)
3137       - void (*)(EditState *, const char *, const char *, const char *); (2)
3138    */
3139  void call_func(void *func, int nb_args, void **args,  void call_func(void *func, int nb_args, void **args,
3140                 unsigned char *args_type)                 unsigned char *args_type)
3141  {  {
3142      switch(nb_args) {      switch (nb_args) {
3143      case 0:      case 0:
3144          ((void (*)())func)();          ((void (*)())func)();
3145          break;          break;
# Line 3190  static int parse_arg(const char **pp, un Line 3210  static int parse_arg(const char **pp, un
3210      get_param(&p, prompt, prompt_size, '{', '}');      get_param(&p, prompt, prompt_size, '{', '}');
3211      get_param(&p, completion, completion_size, '[', ']');      get_param(&p, completion, completion_size, '[', ']');
3212      get_param(&p, history, history_size, '|', '|');      get_param(&p, history, history_size, '|', '|');
3213      switch(type) {      switch (type) {
3214      case 'v':      case 'v':
3215          *argtype = CMD_ARG_INTVAL;          *argtype = CMD_ARG_INTVAL;
3216          break;          break;
# Line 3355  static void parse_args(ExecCmdState *es) Line 3375  static void parse_args(ExecCmdState *es)
3375          /* CG: Should save and restore ec context */          /* CG: Should save and restore ec context */
3376          qs->ec.function = d->name;          qs->ec.function = d->name;
3377          call_func(d->action.func, es->nb_args, es->args, es->args_type);          call_func(d->action.func, es->nb_args, es->args, es->args_type);
3378            /* CG: This doesn't work if the function needs input */
3379          /* CG: Should test for abort condition */          /* CG: Should test for abort condition */
3380          /* CG: Should follow qs->active_window ? */          /* CG: Should follow qs->active_window ? */
3381      } while (--rep_count > 0);      } while (--rep_count > 0);
# Line 3369  static void free_cmd(ExecCmdState *es) Line 3390  static void free_cmd(ExecCmdState *es)
3390      int i;      int i;
3391            
3392      /* free allocated parameters */      /* free allocated parameters */
3393      for(i = 0;i < es->nb_args; i++) {      for (i = 0;i < es->nb_args; i++) {
3394          switch(es->args_type[i]) {          switch (es->args_type[i]) {
3395          case CMD_ARG_STRING:          case CMD_ARG_STRING:
3396              free(es->args[i]);              free(es->args[i]);
3397              break;              break;
# Line 3395  static void arg_edit_cb(void *opaque, ch Line 3416  static void arg_edit_cb(void *opaque, ch
3416          return;          return;
3417      }      }
3418      index = es->nb_args - 1;      index = es->nb_args - 1;
3419      switch(es->args_type[index]) {      switch (es->args_type[index]) {
3420      case CMD_ARG_INT:      case CMD_ARG_INT:
3421          val = strtol(str, &p, 0);          val = strtol(str, &p, 0);
3422          if (*p != '\0') {          if (*p != '\0') {
# Line 3500  static const char *keys_to_str(char *buf Line 3521  static const char *keys_to_str(char *buf
3521      int i;      int i;
3522    
3523      buf[0] = '\0';      buf[0] = '\0';
3524      for(i=0;i<nb_keys;i++) {      for (i = 0; i < nb_keys; i++) {
3525          keytostr(buf1, sizeof(buf1), keys[i]);          keytostr(buf1, sizeof(buf1), keys[i]);
3526          if (i != 0)          if (i != 0)
3527              pstrcat(buf, buf_size, " ");              pstrcat(buf, buf_size, " ");
# Line 3925  void switch_to_buffer(EditState *s, Edit Line 3946  void switch_to_buffer(EditState *s, Edit
3946      b1 = s->b;      b1 = s->b;
3947      if (b1) {      if (b1) {
3948          /* save old buffer data if no other window uses the buffer */          /* save old buffer data if no other window uses the buffer */
3949          for(e = qs->first_window; e != NULL; e = e->next_window) {          for (e = qs->first_window; e != NULL; e = e->next_window) {
3950              if (e != s && e->b == b1)              if (e != s && e->b == b1)
3951                  break;                  break;
3952          }          }
# Line 4032  EditState *edit_find(EditBuffer *b) Line 4053  EditState *edit_find(EditBuffer *b)
4053      QEmacsState *qs = &qe_state;      QEmacsState *qs = &qe_state;
4054      EditState *e;      EditState *e;
4055            
4056      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
4057          if (e->b == b)          if (e->b == b)
4058              break;              break;
4059      }      }
# Line 4141  void buffer_completion(StringArray *cs, Line 4162  void buffer_completion(StringArray *cs,
4162      int len;      int len;
4163    
4164      len = strlen(input);      len = strlen(input);
4165      for(b = qs->first_buffer; b != NULL; b = b->next) {      for (b = qs->first_buffer; b != NULL; b = b->next) {
4166          if (!(b->flags & BF_SYSTEM) && !strncmp(b->name, input, len))          if (!(b->flags & BF_SYSTEM) && !strncmp(b->name, input, len))
4167              add_string(cs, b->name);              add_string(cs, b->name);
4168      }      }
# Line 4169  static CompletionFunc find_completion(co Line 4190  static CompletionFunc find_completion(co
4190      CompletionEntry *p;      CompletionEntry *p;
4191    
4192      if (name[0] != '\0') {      if (name[0] != '\0') {
4193          for(p = first_completion; p != NULL; p = p->next)          for (p = first_completion; p != NULL; p = p->next)
4194              if (!strcmp(name, p->name))              if (!strcmp(name, p->name))
4195                  return p->completion_func;                  return p->completion_func;
4196      }      }
# Line 4220  void do_completion(EditState *s) Line 4241  void do_completion(EditState *s)
4241      outputs = cs.items;      outputs = cs.items;
4242  #if 0  #if 0
4243      printf("count=%d\n", count);      printf("count=%d\n", count);
4244      for(i=0;i<count;i++)      for (i = 0; i < count; i++)
4245          printf("out[%d]=%s\n", i, outputs[i]->str);          printf("out[%d]=%s\n", i, outputs[i]->str);
4246  #endif  #endif
4247      /* no completion ? */      /* no completion ? */
# Line 4228  void do_completion(EditState *s) Line 4249  void do_completion(EditState *s)
4249          goto the_end;          goto the_end;
4250      /* compute the longest match len */      /* compute the longest match len */
4251      match_len = len;      match_len = len;
4252      for(;;) {      for (;;) {
4253          c = outputs[0]->str[match_len];          c = outputs[0]->str[match_len];
4254          if (c == '\0')          if (c == '\0')
4255              break;              break;
4256          for(i=1;i<count;i++)          for (i = 1; i < count; i++)
4257              if (outputs[i]->str[match_len] != c)              if (outputs[i]->str[match_len] != c)
4258                  goto no_match;                  goto no_match;
4259          match_len++;          match_len++;
# Line 4266  void do_completion(EditState *s) Line 4287  void do_completion(EditState *s)
4287              /* modify the list with the current matches */              /* modify the list with the current matches */
4288              qsort(outputs, count, sizeof(StringItem *), completion_sort_func);              qsort(outputs, count, sizeof(StringItem *), completion_sort_func);
4289              eb_delete(b, 0, b->total_size);              eb_delete(b, 0, b->total_size);
4290              for(i=0;i<count;i++) {              for (i = 0; i < count; i++) {
4291                  eb_printf(b, " %s", outputs[i]->str);                  eb_printf(b, " %s", outputs[i]->str);
4292                  if (i != count - 1)                  if (i != count - 1)
4293                      eb_printf(b, "\n");                      eb_printf(b, "\n");
# Line 4314  static StringArray *get_history(const ch Line 4335  static StringArray *get_history(const ch
4335    
4336      if (name[0] == '\0')      if (name[0] == '\0')
4337          return NULL;          return NULL;
4338      for(p = first_history; p != NULL; p = p->next) {      for (p = first_history; p != NULL; p = p->next) {
4339          if (!strcmp(p->name, name))          if (!strcmp(p->name, name))
4340              return &p->history;              return &p->history;
4341      }      }
# Line 4624  static EditBuffer *predict_switch_to_buf Line 4645  static EditBuffer *predict_switch_to_buf
4645      EditState *e;      EditState *e;
4646      EditBuffer *b;      EditBuffer *b;
4647    
4648      for(b = qs->first_buffer; b != NULL; b = b->next) {      for (b = qs->first_buffer; b != NULL; b = b->next) {
4649          if (!(b->flags & BF_SYSTEM)) {          if (!(b->flags & BF_SYSTEM)) {
4650              for(e = qs->first_window; e != NULL; e = e->next_window) {              for (e = qs->first_window; e != NULL; e = e->next_window) {
4651                  if (e->b == b)                  if (e->b == b)
4652                      break;                      break;
4653              }              }
# Line 4704  static void kill_buffer_noconfirm(EditBu Line 4725  static void kill_buffer_noconfirm(EditBu
4725      EditBuffer *b1;      EditBuffer *b1;
4726            
4727      /* find a new buffer to switch to */      /* find a new buffer to switch to */
4728      for(b1 = qs->first_buffer; b1 != NULL; b1 = b1->next) {      for (b1 = qs->first_buffer; b1 != NULL; b1 = b1->next) {
4729          if (b1 != b && !(b1->flags & BF_SYSTEM))          if (b1 != b && !(b1->flags & BF_SYSTEM))
4730              break;              break;
4731      }      }
# Line 4713  static void kill_buffer_noconfirm(EditBu Line 4734  static void kill_buffer_noconfirm(EditBu
4734            
4735      /* if the buffer remains because we cannot delete the main      /* if the buffer remains because we cannot delete the main
4736         window, then switch to the scratch buffer */         window, then switch to the scratch buffer */
4737      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
4738          if (e->b == b) {          if (e->b == b) {
4739              switch_to_buffer(e, b1);              switch_to_buffer(e, b1);
4740          }          }
# Line 4738  static void get_default_path(EditState * Line 4759  static void get_default_path(EditState *
4759          return;          return;
4760      }      }
4761    
4762      if ((b->flags & BF_SYSTEM) || b->name[0] == '*') {      if ((b->flags & BF_SYSTEM)
4763          canonize_absolute_path(buf1, sizeof(buf1), "a");      ||  b->name[0] == '*'
4764          filename = buf1;      ||  b->filename[0] == '\0') {
4765            filename = "a";
4766      } else {      } else {
4767          filename = s->b->filename;          filename = s->b->filename;
4768      }      }
4769        canonize_absolute_path(buf1, sizeof(buf1), filename);
4770      splitpath(buf, buf_size, NULL, 0, filename);      splitpath(buf, buf_size, NULL, 0, filename);
4771  }  }
4772    
# Line 5026  static void quit_examine_buffers(QuitSta Line 5049  static void quit_examine_buffers(QuitSta
5049      while (is->b != NULL) {      while (is->b != NULL) {
5050          b = is->b;          b = is->b;
5051          if (!(b->flags & BF_SYSTEM) && b->filename[0] != '\0' && b->modified) {          if (!(b->flags & BF_SYSTEM) && b->filename[0] != '\0' && b->modified) {
5052              switch(is->state) {              switch (is->state) {
5053              case QS_ASK:              case QS_ASK:
5054                  /* XXX: display cursor */                  /* XXX: display cursor */
5055                  put_status(NULL, "Save file %s? (y, n, !, ., q) ",                  put_status(NULL, "Save file %s? (y, n, !, ., q) ",
# Line 5063  static void quit_key(void *opaque, int c Line 5086  static void quit_key(void *opaque, int c
5086      QuitState *is = opaque;      QuitState *is = opaque;
5087      EditBuffer *b;      EditBuffer *b;
5088    
5089      switch(ch) {      switch (ch) {
5090      case 'y':      case 'y':
5091      case ' ':      case ' ':
5092          /* save buffer */          /* save buffer */
# Line 5133  int eb_search(EditBuffer *b, int offset, Line 5156  int eb_search(EditBuffer *b, int offset,
5156      if (flags & SEARCH_FLAG_SMARTCASE) {      if (flags & SEARCH_FLAG_SMARTCASE) {
5157          upper_count = 0;          upper_count = 0;
5158          lower_count = 0;          lower_count = 0;
5159          for(i=0;i<size;i++) {          for (i = 0; i < size; i++) {
5160              c = buf[i];              c = buf[i];
5161              lower_count += islower(c);              lower_count += islower(c);
5162              upper_count += isupper(c);              upper_count += isupper(c);
# Line 5143  int eb_search(EditBuffer *b, int offset, Line 5166  int eb_search(EditBuffer *b, int offset,
5166      }      }
5167    
5168      /* copy buffer */      /* copy buffer */
5169      for(i=0;i<size;i++) {      for (i = 0; i < size; i++) {
5170          c = buf[i];          c = buf[i];
5171          if (flags & SEARCH_FLAG_IGNORECASE)          if (flags & SEARCH_FLAG_IGNORECASE)
5172              buf1[i] = toupper(c);              buf1[i] = toupper(c);
# Line 5158  int eb_search(EditBuffer *b, int offset, Line 5181  int eb_search(EditBuffer *b, int offset,
5181          offset--;          offset--;
5182      }      }
5183                    
5184      for(;;) {      for (;;) {
5185          offset += dir;          offset += dir;
5186          if (offset < 0)          if (offset < 0)
5187              return -1;              return -1;
# Line 5183  int eb_search(EditBuffer *b, int offset, Line 5206  int eb_search(EditBuffer *b, int offset,
5206    
5207      word_start_found:      word_start_found:
5208          i = 0;          i = 0;
5209          for(;;) {          for (;;) {
5210              eb_read(b, offset + i, &ch, 1);              eb_read(b, offset + i, &ch, 1);
5211              if (flags & SEARCH_FLAG_IGNORECASE)              if (flags & SEARCH_FLAG_IGNORECASE)
5212                  ch = toupper(ch);                  ch = toupper(ch);
# Line 5310  static void isearch_display(ISearchState Line 5333  static void isearch_display(ISearchState
5333      if (is->dir < 0)      if (is->dir < 0)
5334          usprintf(&uq, " backward");          usprintf(&uq, " backward");
5335      usprintf(&uq, ": ");      usprintf(&uq, ": ");
5336      for(i=0;i<is->pos;i++) {      for (i = 0; i < is->pos; i++) {
5337          v = is->search_string[i];          v = is->search_string[i];
5338          if (!(v & FOUND_TAG)) {          if (!(v & FOUND_TAG)) {
5339              uq = utf8_encode(uq, v);              uq = utf8_encode(uq, v);
# Line 5346  static void isearch_key(void *opaque, in Line 5369  static void isearch_key(void *opaque, in
5369          /* save current searched string */          /* save current searched string */
5370          if (is->pos > 0) {          if (is->pos > 0) {
5371              j = 0;              j = 0;
5372              for(i=0;i<is->pos;i++) {              for (i = 0; i < is->pos; i++) {
5373                  if (!(is->search_string[i] & FOUND_TAG))                  if (!(is->search_string[i] & FOUND_TAG))
5374                      last_search_string[j++] = is->search_string[i];                      last_search_string[j++] = is->search_string[i];
5375              }              }
# Line 5439  static int to_bytes(EditState *s1, u8 *d Line 5462  static int to_bytes(EditState *s1, u8 *d
5462          s = str;          s = str;
5463          h = 0;          h = 0;
5464          hex_nibble = 0;          hex_nibble = 0;
5465          for(;;) {          for (;;) {
5466              c = *s++;              c = *s++;
5467              if (c == '\0')              if (c == '\0')
5468                  break;                  break;
# Line 5529  static void query_replace_key(void *opaq Line 5552  static void query_replace_key(void *opaq
5552  {  {
5553      QueryReplaceState *is = opaque;      QueryReplaceState *is = opaque;
5554    
5555      switch(ch) {      switch (ch) {
5556      case 'y':      case 'y':
5557      case ' ':      case ' ':
5558          query_replace_replace(is);          query_replace_replace(is);
# Line 5636  void do_refresh(EditState *s1) Line 5659  void do_refresh(EditState *s1)
5659      QEmacsState *qs = &qe_state;      QEmacsState *qs = &qe_state;
5660      EditState *e;      EditState *e;
5661      int new_status_height, new_mode_line_height, content_height;      int new_status_height, new_mode_line_height, content_height;
5662      int width, height;      int width, height, resized;
5663    
5664      if (qs->complete_refresh) {      if (qs->complete_refresh) {
5665          if (qs->screen->dpy.dpy_invalidate)          if (qs->screen->dpy.dpy_invalidate)
# Line 5661  void do_refresh(EditState *s1) Line 5684  void do_refresh(EditState *s1)
5684      if (!qs->hide_status)      if (!qs->hide_status)
5685          content_height -= new_status_height;          content_height -= new_status_height;
5686    
5687        resized = 0;
5688    
5689      /* see if resize is necessary */      /* see if resize is necessary */
5690      if (qs->width != width ||      if (qs->width != width ||
5691          qs->height != height ||          qs->height != height ||
5692          qs->status_height != new_status_height ||          qs->status_height != new_status_height ||
5693          qs->mode_line_height != new_mode_line_height ||          qs->mode_line_height != new_mode_line_height ||
5694          qs->content_height != content_height) {          qs->content_height != content_height) {
5695            
5696          /* do the resize */          /* do the resize */
5697          for(e = qs->first_window; e != NULL; e = e->next_window) {          resized = 1;
5698            for (e = qs->first_window; e != NULL; e = e->next_window) {
5699              if (e->minibuf) {              if (e->minibuf) {
5700                  /* first resize minibuffer if present */                  /* first resize minibuffer if present */
5701                  e->x1 = 0;                  e->x1 = 0;
# Line 5699  void do_refresh(EditState *s1) Line 5725  void do_refresh(EditState *s1)
5725          qs->content_height = content_height;          qs->content_height = content_height;
5726      }      }
5727      /* compute client area */      /* compute client area */
5728      for(e = qs->first_window; e != NULL; e = e->next_window)      for (e = qs->first_window; e != NULL; e = e->next_window)
5729          compute_client_area(e);          compute_client_area(e);
5730    
5731      /* invalidate all the edit windows and draw borders */      /* invalidate all the edit windows and draw borders */
5732      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
5733          edit_invalidate(e);          edit_invalidate(e);
5734          e->borders_invalid = 1;          e->borders_invalid = 1;
5735      }      }
5736      /* invalidate status line */      /* invalidate status line */
5737      qs->status_shadow[0] = '\0';      qs->status_shadow[0] = '\0';
5738      put_status(NULL, " ");  
5739        if (resized) {
5740            put_status(NULL, "Screen is now %d by %d", width, height);
5741        } else {
5742            put_status(NULL, " ");
5743        }
5744  }  }
5745    
5746  void do_refresh_complete(EditState *s)  void do_refresh_complete(EditState *s)
# Line 5736  void do_previous_window(EditState *s) Line 5767  void do_previous_window(EditState *s)
5767      QEmacsState *qs = s->qe_state;      QEmacsState *qs = s->qe_state;
5768      EditState *e;      EditState *e;
5769    
5770      for(e = qs->first_window; e->next_window != NULL; e = e->next_window) {      for (e = qs->first_window; e->next_window != NULL; e = e->next_window) {
5771          if (e->next_window == s)          if (e->next_window == s)
5772              break;              break;
5773      }      }
# Line 5754  void do_delete_window(EditState *s, int Line 5785  void do_delete_window(EditState *s, int
5785      int ex1, ey1, ex2, ey2;      int ex1, ey1, ex2, ey2;
5786    
5787      count = 0;      count = 0;
5788      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
5789          if (!e->minibuf && !(e->flags & WF_POPUP))          if (!e->minibuf && !(e->flags & WF_POPUP))
5790              count++;              count++;
5791      }      }
# Line 5812  void do_delete_other_windows(EditState * Line 5843  void do_delete_other_windows(EditState *
5843      QEmacsState *qs = s->qe_state;      QEmacsState *qs = s->qe_state;
5844      EditState *e, *e1;      EditState *e, *e1;
5845            
5846      for(e = qs->first_window; e != NULL; e = e1) {      for (e = qs->first_window; e != NULL; e = e1) {
5847          e1 = e->next_window;          e1 = e->next_window;
5848          if (!e->minibuf && e != s)          if (!e->minibuf && e != s)
5849              edit_close(e);              edit_close(e);
# Line 5883  static void print_bindings(EditBuffer *b Line 5914  static void print_bindings(EditBuffer *b
5914          while (d->name != NULL) {          while (d->name != NULL) {
5915              /* find each key mapping pointing to this command */              /* find each key mapping pointing to this command */
5916              found = 0;              found = 0;
5917              for(k = first_key; k != NULL; k = k->next) {              for (k = first_key; k != NULL; k = k->next) {
5918                  if (k->cmd == d && k->mode == mode) {                  if (k->cmd == d && k->mode == mode) {
5919                      if (!gfound)                      if (!gfound)
5920                          eb_printf(b, "%s:\n\n", title);                          eb_printf(b, "%s:\n\n", title);
# Line 6048  void window_resize(EditState *s, int tar Line 6079  void window_resize(EditState *s, int tar
6079          (s->y2 >= qs->screen->height - qs->status_height && delta_y != 0))          (s->y2 >= qs->screen->height - qs->status_height && delta_y != 0))
6080          return;          return;
6081    
6082      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
6083          if (e->minibuf || e == s)          if (e->minibuf || e == s)
6084              continue;              continue;
6085          window_get_min_size(e, &min_w, &min_h);          window_get_min_size(e, &min_w, &min_h);
# Line 6073  void window_resize(EditState *s, int tar Line 6104  void window_resize(EditState *s, int tar
6104      }      }
6105    
6106      /* now everything is OK, we can resize all windows */      /* now everything is OK, we can resize all windows */
6107      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
6108          if (e->minibuf || e == s)          if (e->minibuf || e == s)
6109              continue;              continue;
6110          if (e->y1 == s->y2)          if (e->y1 == s->y2)
# Line 6107  int check_motion_target(EditState *s) Line 6138  int check_motion_target(EditState *s)
6138      QEmacsState *qs = &qe_state;      QEmacsState *qs = &qe_state;
6139      EditState *e;      EditState *e;
6140      /* first verify that window is always valid */      /* first verify that window is always valid */
6141      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
6142          if (e == motion_target)          if (e == motion_target)
6143              break;              break;
6144      }      }
# Line 6122  static void save_selection(void) Line 6153  static void save_selection(void)
6153      int selection_showed;      int selection_showed;
6154    
6155      selection_showed = 0;      selection_showed = 0;
6156      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
6157          selection_showed |= e->show_selection;          selection_showed |= e->show_selection;
6158          e->show_selection = 0;          e->show_selection = 0;
6159      }      }
# Line 6157  void mouse_event(QEEvent *ev) Line 6188  void mouse_event(QEEvent *ev)
6188      mouse_x = ev->button_event.x;      mouse_x = ev->button_event.x;
6189      mouse_y = ev->button_event.y;      mouse_y = ev->button_event.y;
6190    
6191      switch(ev->type) {      switch (ev->type) {
6192      case QE_BUTTON_RELEASE_EVENT:      case QE_BUTTON_RELEASE_EVENT:
6193          save_selection();          save_selection();
6194          motion_type = MOTION_NONE;          motion_type = MOTION_NONE;
6195          break;          break;
6196    
6197      case QE_BUTTON_PRESS_EVENT:      case QE_BUTTON_PRESS_EVENT:
6198          for(e = qs->first_window; e != NULL; e = e->next_window) {          for (e = qs->first_window; e != NULL; e = e->next_window) {
6199              /* test if mouse is inside the text area */              /* test if mouse is inside the text area */
6200              if (mouse_x >= e->xleft && mouse_x < e->xleft + e->width &&              if (mouse_x >= e->xleft && mouse_x < e->xleft + e->width &&
6201                  mouse_y >= e->ytop && mouse_y < e->ytop + e->height) {                  mouse_y >= e->ytop && mouse_y < e->ytop + e->height) {
# Line 6172  void mouse_event(QEEvent *ev) Line 6203  void mouse_event(QEEvent *ev)
6203                      save_selection();                      save_selection();
6204                      e->mode->mouse_goto(e, mouse_x - e->xleft,                      e->mode->mouse_goto(e, mouse_x - e->xleft,
6205                                          mouse_y - e->ytop);                                          mouse_y - e->ytop);
6206                      switch(ev->button_event.button) {                      switch (ev->button_event.button) {
6207                      case QE_BUTTON_LEFT:                      case QE_BUTTON_LEFT:
6208                          motion_type = MOTION_TEXT;                          motion_type = MOTION_TEXT;
6209                          motion_x = 0; /* indicate first move */                          motion_x = 0; /* indicate first move */
# Line 6217  void mouse_event(QEEvent *ev) Line 6248  void mouse_event(QEEvent *ev)
6248          }          }
6249          break;          break;
6250      case QE_MOTION_EVENT:      case QE_MOTION_EVENT:
6251          switch(motion_type) {          switch (motion_type) {
6252          case MOTION_NONE:          case MOTION_NONE:
6253          default:          default:
6254              break;              break;
# Line 6300  void qe_handle_event(QEEvent *ev) Line 6331  void qe_handle_event(QEEvent *ev)
6331  {  {
6332      QEmacsState *qs = &qe_state;      QEmacsState *qs = &qe_state;
6333    
6334      switch(ev->type) {      switch (ev->type) {
6335      case QE_KEY_EVENT:      case QE_KEY_EVENT:
6336          qe_key_process(ev->key_event.key);          qe_key_process(ev->key_event.key);
6337          break;          break;
# Line 6554  int parse_config_file(EditState *s, cons Line 6585  int parse_config_file(EditState *s, cons
6585    
6586          for (i = 0; i < nb_args; i++) {          for (i = 0; i < nb_args; i++) {
6587              /* pseudo arguments: skip them */              /* pseudo arguments: skip them */
6588              switch(args_type[i]) {              switch (args_type[i]) {
6589              case CMD_ARG_WINDOW:              case CMD_ARG_WINDOW:
6590                  args[i] = (void *)s;                  args[i] = (void *)s;
6591                  continue;                  continue;
# Line 6566  int parse_config_file(EditState *s, cons Line 6597  int parse_config_file(EditState *s, cons
6597                            
6598              skip_spaces(&p);              skip_spaces(&p);
6599              if (sep) {              if (sep) {
6600                    /* Should test for arg list too short. */
6601                    /* Could supply default arguments. */
6602                  if (!expect_token(&p, sep))                  if (!expect_token(&p, sep))
6603                      goto fail;                      goto fail;
6604              }              }
# Line 6594  int parse_config_file(EditState *s, cons Line 6627  int parse_config_file(EditState *s, cons
6627                      c = *p++;                      c = *p++;
6628                      if (c == '\\') {                      if (c == '\\') {
6629                          c = *p++;                          c = *p++;
6630                          switch(c) {                          switch (c) {
6631                          case 'n':                          case 'n':
6632                              c = '\n';                              c = '\n';
6633                              break;                              break;
# Line 6808  int parse_command_line(int argc, char ** Line 6841  int parse_command_line(int argc, char **
6841  void set_user_option(const char *user)  void set_user_option(const char *user)
6842  {  {
6843      QEmacsState *qs = &qe_state;      QEmacsState *qs = &qe_state;
6844      char path[1024];      char path[MAX_FILENAME_SIZE];
6845      const char *home_path;      const char *home_path;
6846    
6847      user_option = user;      user_option = user;
6848      /* compute resources path */      /* compute resources path */
6849      pstrcpy(qs->res_path, sizeof(qs->res_path),      pstrcpy(qs->res_path, sizeof(qs->res_path),
6850             CONFIG_QE_PREFIX "/share/qe:" CONFIG_QE_PREFIX "/lib/qe:"              CONFIG_QE_PREFIX "/share/qe:" CONFIG_QE_PREFIX "/lib/qe:"
6851             "/usr/share/qe:/usr/lib/qe");              "/usr/share/qe:/usr/lib/qe");
6852      if (user) {      if (user) {
6853          /* use ~USER/.qe instead of ~/.qe */          /* use ~USER/.qe instead of ~/.qe */
6854          /* CG: should get user homedir */          /* CG: should get user homedir */

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26