* src/profiler.c: Delete.
[bpt/emacs.git] / src / term.c
index aa0be98..e2c7781 100644 (file)
@@ -527,9 +527,6 @@ static ptrdiff_t encode_terminal_dst_size;
    Set CODING->produced to the byte-length of the resulting byte
    sequence, and return a pointer to that byte sequence.  */
 
-#ifndef DOS_NT
-static
-#endif
 unsigned char *
 encode_terminal_code (struct glyph *src, int src_len,
                      struct coding_system *coding)
@@ -1864,7 +1861,7 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
            acronym = XCDR (acronym);
          buf[0] = '[';
          str = STRINGP (acronym) ? SSDATA (acronym) : "";
-         for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++)
+         for (len = 0; len < 6 && str[len] && ASCII_CHAR_P (str[len]); len++)
            buf[1 + len] = str[len];
          buf[1 + len] = ']';
          len += 2;
@@ -2934,8 +2931,7 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces,
       display_tty_menu_item (menu->text[j], max_width, face, x, y + i,
                             menu->submenu[j] != NULL);
     }
-  update_frame_with_menu (sf);
-  cursor_to (sf, row, col);
+  update_frame_with_menu (sf, row, col);
 }
 
 /* --------------------------- X Menu emulation ---------------------- */
@@ -3106,7 +3102,7 @@ static void
 screen_update (struct frame *f, struct glyph_matrix *mtx)
 {
   restore_desired_matrix (f, mtx);
-  update_frame_with_menu (f);
+  update_frame_with_menu (f, -1, -1);
 }
 
 typedef enum {
@@ -3255,7 +3251,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
 
   /* Force update of the current frame, so that the desired and the
      current matrices are identical.  */
-  update_frame_with_menu (sf);
+  update_frame_with_menu (sf, -1, -1);
   state[0].menu = menu;
   state[0].screen_behind = save_and_enable_current_matrix (sf);
 
@@ -3400,8 +3396,6 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
                            state[statecount - 1].y,
                            state[statecount - 1].pane,
                            faces, x, y, first_item, 1);
-         tty_hide_cursor (tty);
-         fflush (tty->output);
          /* The call to display help-echo below will move the cursor,
             so remember its current position as computed by
             tty_menu_display.  */
@@ -3420,10 +3414,13 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
             item, so that screen readers and other accessibility aids
             know where the active region is.  */
          cursor_to (sf, row, col);
-         tty_hide_cursor (tty);
-         fflush (tty->output);
          prev_menu_help_message = menu_help_message;
        }
+      /* Both tty_menu_display and help_callback invoke update_end,
+        which calls tty_show_cursor.  Re-hide it, so it doesn't show
+        through the menus.  */
+      tty_hide_cursor (tty);
+      fflush (tty->output);
     }
 
   sf->mouse_moved = 0;
@@ -3582,6 +3579,7 @@ tty_menu_new_item_coords (struct frame *f, int which, int *x, int *y)
     }
 }
 
+/* WINDOWSNT uses this as menu_show_hook, see w32console.c.  */
 Lisp_Object
 tty_menu_show (struct frame *f, int x, int y, int menuflags,
               Lisp_Object title, const char **error_name)
@@ -3617,9 +3615,7 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags,
       return Qnil;
     }
 
-  /* Don't GC while we prepare and show the menu, because we give the
-     menu functions pointers to the contents of strings.  */
-  specpdl_count = inhibit_garbage_collection ();
+  dynwind_begin ();
 
   /* Avoid crashes if, e.g., another client will connect while we
      are in a menu.  */
@@ -3853,7 +3849,7 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags,
 
  tty_menu_end:
 
-  unbind_to (specpdl_count, Qnil);
+  dynwind_end ();
   return entry;
 }
 
@@ -4545,6 +4541,8 @@ delete_tty (struct terminal *terminal)
 void
 syms_of_term (void)
 {
+#include "term.x"
+
   DEFVAR_BOOL ("system-uses-terminfo", system_uses_terminfo,
     doc: /* Non-nil means the system uses terminfo rather than termcap.
 This variable can be used by terminal emulator packages.  */);
@@ -4574,19 +4572,6 @@ What means \"very visible\" is up to your terminal.  It may make the cursor
 bigger, or it may make it blink, or it may do nothing at all.  */);
   visible_cursor = 1;
 
-  defsubr (&Stty_display_color_p);
-  defsubr (&Stty_display_color_cells);
-  defsubr (&Stty_no_underline);
-  defsubr (&Stty_type);
-  defsubr (&Scontrolling_tty_p);
-  defsubr (&Stty_top_frame);
-  defsubr (&Ssuspend_tty);
-  defsubr (&Sresume_tty);
-#ifdef HAVE_GPM
-  defsubr (&Sgpm_mouse_start);
-  defsubr (&Sgpm_mouse_stop);
-#endif /* HAVE_GPM */
-
 #ifndef DOS_NT
   default_orig_pair = NULL;
   default_set_foreground = NULL;