]> code.delx.au - gnu-emacs/blobdiff - src/keyboard.c
(get_adstyle_property): Fix previous change.
[gnu-emacs] / src / keyboard.c
index e5d0896100116c430bffdc35fd60e012e1f7d8cc..527a82b55ff089a9887e7df925a2e6e6372777fc 100644 (file)
@@ -471,6 +471,8 @@ Lisp_Object Qmake_frame_visible;
 Lisp_Object Qselect_window;
 Lisp_Object Qhelp_echo;
 
+extern Lisp_Object Qremap;
+
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
 Lisp_Object Qmouse_fixup_help_message;
 #endif
@@ -2046,6 +2048,20 @@ adjust_point_for_property (last_pt, modified)
 
          /* Find boundaries `beg' and `end' of the invisible area, if any.  */
          while (end < ZV
+                /* Stop if we find a spot between two runs of
+                   `invisible' where inserted text would be visible.
+                   This is important when we have two invisible
+                   boundaries that enclose an area: if the area is
+                   empty, we need this test in order to make it
+                   possible to place point in the middle rather than
+                   skip both boundaries.
+                   Note that this will stop anywhere in a non-sticky
+                   text-property, but I don't think there's much we
+                   can do about that.  */
+                && (val = get_pos_property (make_number (end),
+                                            Qinvisible, Qnil),
+                    TEXT_PROP_MEANS_INVISIBLE (val))
+                /* FIXME: write and then use get_pos_property_and_overlay.  */
                 && !NILP (val = get_char_property_and_overlay
                           (make_number (end), Qinvisible, Qnil, &overlay))
                 && (inv = TEXT_PROP_MEANS_INVISIBLE (val)))
@@ -2059,6 +2075,9 @@ adjust_point_for_property (last_pt, modified)
              end = NATNUMP (tmp) ? XFASTINT (tmp) : ZV;
            }
          while (beg > BEGV
+                && (val = get_pos_property (make_number (beg),
+                                            Qinvisible, Qnil),
+                    TEXT_PROP_MEANS_INVISIBLE (val))
                 && !NILP (val = get_char_property_and_overlay
                           (make_number (beg - 1), Qinvisible, Qnil, &overlay))
                 && (inv = TEXT_PROP_MEANS_INVISIBLE (val)))
@@ -2182,16 +2201,24 @@ struct atimer *poll_timer;
 
 #ifdef POLL_FOR_INPUT
 
-/* Poll for input, so what we catch a C-g if it comes in.  This
+/* Poll for input, so that we catch a C-g if it comes in.  This
    function is called from x_make_frame_visible, see comment
    there.  */
 
 void
 poll_for_input_1 ()
 {
+/* Tell ns_read_socket() it is being called asynchronously so it can avoid
+   doing anything dangerous. */
+#ifdef HAVE_NS
+  ++handling_signal;
+#endif
   if (interrupt_input_blocked == 0
       && !waiting_for_input)
     read_avail_input (0);
+#ifdef HAVE_NS
+  --handling_signal;
+#endif
 }
 
 /* Timer callback function for poll_timer.  TIMER is equal to
@@ -4133,6 +4160,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
           else
             obj = Fcons (intern ("ns-unput-working-text"), Qnil);
          kbd_fetch_ptr = event + 1;
+         *used_mouse_menu = 1;
         }
 #endif
 
@@ -4287,6 +4315,11 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
                      || event->kind == TOOL_BAR_EVENT))
                *used_mouse_menu = 1;
 #endif
+#ifdef HAVE_NS
+             /* certain system events are non-key events */
+             if (event->kind == NS_NONKEY_EVENT)
+               *used_mouse_menu = 1;
+#endif
 
              /* Wipe out this event, to catch bugs.  */
              clear_event (event);
@@ -4660,10 +4693,9 @@ timer_check (do_it_now)
 
 DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0,
        doc: /* Return the current length of Emacs idleness, or nil.
-The value when Emacs is idle is a list of three integers.  The first has the
-most significant 16 bits of the seconds, while the second has the
-least significant 16 bits.  The third integer gives the microsecond
-count.
+The value when Emacs is idle is a list of three integers.  The first has
+the most significant 16 bits of the seconds, while the second has the least
+significant 16 bits.  The third integer gives the microsecond count.
 
 The value when Emacs is not idle is nil.
 
@@ -5527,6 +5559,12 @@ make_lispy_event (event)
        return lispy_c;
       }
 
+#ifdef HAVE_NS
+      /* NS_NONKEY_EVENTs are just like NON_ASCII_KEYSTROKE_EVENTs,
+        except that they are non-key events (last-nonmenu-event is nil). */
+    case NS_NONKEY_EVENT:
+#endif
+
       /* A function key.  The symbol may need to have modifier prefixes
         tacked onto it.  */
     case NON_ASCII_KEYSTROKE_EVENT:
@@ -7146,17 +7184,23 @@ tty_read_avail_input (struct terminal *terminal,
   {
       Gpm_Event event;
       struct input_event hold_quit;
-      int gpm;
+      int gpm, fd = gpm_fd;
 
       EVENT_INIT (hold_quit);
       hold_quit.kind = NO_EVENT;
 
+      /* gpm==1 if event received.
+         gpm==0 if the GPM daemon has closed the connection, in which case
+                Gpm_GetEvent closes gpm_fd and clears it to -1, which is why
+               we save it in `fd' so close_gpm can remove it from the
+               select masks.
+         gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */
       while (gpm = Gpm_GetEvent (&event), gpm == 1) {
          nread += handle_one_term_event (tty, &event, &hold_quit);
       }
-      if (gpm < 0)
+      if (gpm == 0)
        /* Presumably the GPM daemon has closed the connection.  */
-       close_gpm ();
+       close_gpm (fd);
       if (hold_quit.kind != NO_EVENT)
          kbd_buffer_store_event (&hold_quit);
       if (nread)
@@ -7276,7 +7320,11 @@ handle_async_input ()
 #ifdef SYNC_INPUT
   pending_signals = pending_atimers;
 #endif
-
+/* Tell ns_read_socket() it is being called asynchronously so it can avoid
+   doing anything dangerous. */
+#ifdef HAVE_NS
+  ++handling_signal;
+#endif
   while (1)
     {
       int nread;
@@ -7287,6 +7335,9 @@ handle_async_input ()
       if (nread <= 0)
        break;
     }
+#ifdef HAVE_NS
+  --handling_signal;
+#endif
 }
 
 void
@@ -8023,6 +8074,11 @@ parse_menu_item (item, notreal, inmenubar)
              && ! NILP (Fget (def, Qmenu_alias)))
            def = XSYMBOL (def)->function;
          tem = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qt);
+
+         /* Don't display remap bindings.*/
+         if (VECTORP (tem) && ASIZE (tem) > 0 && EQ (AREF (tem, 0), Qremap))
+           tem = Qnil;
+
          XSETCAR (cachelist, tem);
          if (NILP (tem))
            {
@@ -12164,7 +12220,7 @@ Buffer modification stores t in this variable.  */);
   staticpro (&Qdeactivate_mark);
 
   DEFVAR_LISP ("command-hook-internal", &Vcommand_hook_internal,
-              doc: /* Temporary storage of pre-command-hook or post-command-hook.  */);
+              doc: /* Temporary storage of `pre-command-hook' or `post-command-hook'.  */);
   Vcommand_hook_internal = Qnil;
 
   DEFVAR_LISP ("pre-command-hook", &Vpre_command_hook,
@@ -12341,7 +12397,7 @@ to be used as input.  If it wants to put back some events
 to be reconsidered, separately, by the input method,
 it can add them to the beginning of `unread-command-events'.
 
-The input method function can find in `input-method-previous-method'
+The input method function can find in `input-method-previous-message'
 the previous echo area message.
 
 The input method function should refer to the variables