]> code.delx.au - gnu-emacs/commitdiff
Merge from trunk.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Oct 2011 15:23:32 +0000 (08:23 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Oct 2011 15:23:32 +0000 (08:23 -0700)
15 files changed:
autogen/configure
etc/NEWS
lisp/ChangeLog
lisp/emacs-lisp/timer.el
lisp/simple.el
lwlib/ChangeLog
lwlib/lwlib-Xaw.c
lwlib/lwlib-Xm.c
lwlib/lwlib-utils.c
lwlib/lwlib.c
lwlib/xlwmenu.c
src/ChangeLog
src/bidi.c
src/editfns.c
src/xdisp.c

index e86db7a7362cf568a39b231773b320b22b8bce09..8f50731f3f178ec617112d27fe093cdf9eacd4f0 100755 (executable)
@@ -14349,6 +14349,8 @@ done
 # than to expect to find it in ncurses.
 # Also we need tputs and friends to be able to build at all.
 have_tputs_et_al=true
+# Maybe curses should be tried earlier?
+# See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5
 $as_echo_n "checking for library containing tputs... " >&6; }
 if test "${ac_cv_search_tputs+set}" = set; then :
@@ -14373,7 +14375,7 @@ return tputs ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' ncurses terminfo termcap; do
+for ac_lib in '' ncurses terminfo termcap curses; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
@@ -14408,9 +14410,11 @@ else
 fi
 
 if test "$have_tputs_et_al" != true; then
-  as_fn_error "I couldn't find termcap functions (tputs and friends).
-Maybe some development libraries/packages are missing?  Try installing
-libncurses-dev(el), libterminfo-dev(el) or similar." "$LINENO" 5
+  as_fn_error "The required function \`tputs' was not found in any library.
+These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
+Please try installing whichever of these libraries is most appropriate
+for your system, together with its header files.
+For example, a libncurses-dev(el) or similar package." "$LINENO" 5
 fi
 # Must define this when any termcap library is found.
 
index 8095cd964f62c676df37807dbdb9f526f5ce7b70..b9fed18355df986c415e70786db64186ec7cf562 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -186,8 +186,8 @@ Text that includes characters from right-to-left (RTL) scripts, such
 as Arabic, Farsi, or Hebrew, is displayed in the correct visual order
 as expected by users of those scripts.  This display reordering is a
 "Full bidirectionality" class implementation of the Unicode
-Bidirectional Algorithm.  Buffers RTL text should look exactly the
-same as before.
+Bidirectional Algorithm.  Buffers with no RTL text should look exactly
+the same as before.
 
 For more information, see the node "Bidirectional Editing" in the
 Emacs Manual.
index 62d7cc449ab2c6cc8b60e654fa1cec1100db80a9..10570c2a878b79096006ce356e2837a4c3265b15 100644 (file)
@@ -1,3 +1,15 @@
+2011-10-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * simple.el (what-cursor-position): Fix the display of the
+       character info for LRE, LRO, RLE, and RLO characters by appending
+       an invisible PDF.
+
+2011-10-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/timer.el (with-timeout): Make sure we cancel the timer
+       even in case of error; add debug spec; simplify data flow.
+       (with-timeout-handler): Remove.
+
 2011-10-12  Michael Albinus  <michael.albinus@gmx.de>
 
        Fix Bug#6019, Bug#9315.
index 0e007ff71760f364fa9ccc83d9384ed8cce57667..706c6fd0ba3a812c00c30a94fb9446af3731ffaa 100644 (file)
@@ -402,10 +402,6 @@ This function returns a timer object which you can use in `cancel-timer'."
     (timer-activate-when-idle timer t)
     timer))
 \f
-(defun with-timeout-handler (tag)
-  "This is the timer function used for the timer made by `with-timeout'."
-  (throw tag 'timeout))
-
 (defvar with-timeout-timers nil
   "List of all timers used by currently pending `with-timeout' calls.")
 
@@ -417,24 +413,27 @@ event (such as keyboard input, input from subprocesses, or a certain time);
 if the program loops without waiting in any way, the timeout will not
 be detected.
 \n(fn (SECONDS TIMEOUT-FORMS...) BODY)"
-  (declare (indent 1))
+  (declare (indent 1) (debug ((form body) body)))
   (let ((seconds (car list))
-       (timeout-forms (cdr list)))
-    `(let ((with-timeout-tag (cons nil nil))
-          with-timeout-value with-timeout-timer
-          (with-timeout-timers with-timeout-timers))
-       (if (catch with-timeout-tag
-            (progn
-              (setq with-timeout-timer
-                    (run-with-timer ,seconds nil
-                                     'with-timeout-handler
-                                     with-timeout-tag))
-              (push with-timeout-timer with-timeout-timers)
-              (setq with-timeout-value (progn . ,body))
-              nil))
-          (progn . ,timeout-forms)
-        (cancel-timer with-timeout-timer)
-        with-timeout-value))))
+       (timeout-forms (cdr list))
+        (timeout (make-symbol "timeout")))
+    `(let ((-with-timeout-value-
+            (catch ',timeout
+              (let* ((-with-timeout-timer-
+                      (run-with-timer ,seconds nil
+                                      (lambda () (throw ',timeout ',timeout))))
+                     (with-timeout-timers
+                         (cons -with-timeout-timer- with-timeout-timers)))
+                (unwind-protect
+                    ,@body
+                  (cancel-timer -with-timeout-timer-))))))
+       ;; It is tempting to avoid the `if' altogether and instead run
+       ;; timeout-forms in the timer, just before throwing `timeout'.
+       ;; But that would mean that timeout-forms are run in the deeper
+       ;; dynamic context of the timer, with inhibit-quit set etc...
+       (if (eq -with-timeout-value- ',timeout)
+           (progn ,@timeout-forms)
+         -with-timeout-value-))))
 
 (defun with-timeout-suspend ()
   "Stop the clock for `with-timeout'.  Used by debuggers.
index af6d855d9c0dea626e5e284ce8e1dc96e79763e0..6d0e7543549d4265f5ac3da081960f8cae9dee24 100644 (file)
@@ -1050,6 +1050,16 @@ In addition, with prefix argument, show details about that character
 in *Help* buffer.  See also the command `describe-char'."
   (interactive "P")
   (let* ((char (following-char))
+        ;; If the character is one of LRE, LRO, RLE, RLO, it will
+        ;; start a directional embedding, which could completely
+        ;; disrupt the rest of the line (e.g., RLO will display the
+        ;; rest of the line right-to-left).  So we put an invisible
+        ;; PDF character after these characters, to end the
+        ;; embedding, which eliminates any effects on the rest of the
+        ;; line.
+        (pdf (if (memq char '(?\x202a ?\x202b ?\x202d ?\x202e))
+                 (propertize (string ?\x202c) 'invisible t)
+               ""))
         (beg (point-min))
         (end (point-max))
          (pos (point))
@@ -1109,18 +1119,18 @@ in *Help* buffer.  See also the command `describe-char'."
            ;; We show the detailed information about CHAR.
            (describe-char (point)))
        (if (or (/= beg 1) (/= end (1+ total)))
-           (message "Char: %s %s point=%d of %d (%d%%) <%d-%d> column=%d%s"
+           (message "Char: %s%s %s point=%d of %d (%d%%) <%d-%d> column=%d%s"
                     (if (< char 256)
                         (single-key-description char)
                       (buffer-substring-no-properties (point) (1+ (point))))
-                    encoding-msg pos total percent beg end col hscroll)
-         (message "Char: %s %s point=%d of %d (%d%%) column=%d%s"
+                    pdf encoding-msg pos total percent beg end col hscroll)
+         (message "Char: %s%s %s point=%d of %d (%d%%) column=%d%s"
                   (if enable-multibyte-characters
                       (if (< char 128)
                           (single-key-description char)
                         (buffer-substring-no-properties (point) (1+ (point))))
                     (single-key-description char))
-                  encoding-msg pos total percent col hscroll))))))
+                  pdf encoding-msg pos total percent col hscroll))))))
 \f
 ;; Initialize read-expression-map.  It is defined at C level.
 (let ((m (make-sparse-keymap)))
index 7e332a9fd5d9b851d4d2a7c2398a8bfa0a16ccd7..3b494865f0c86387a46a6ef5dea4358eec5a9b21 100644 (file)
@@ -1,3 +1,13 @@
+2011-10-13  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * lwlib-Xaw.c (openFont, xaw_destroy_instance): Replace free with
+       xfree to avoid crash when xmalloc overrun checking is enabled.
+       * lwlib-Xm.c (free_destroyed_instance, xm_update_one_value): Ditto.
+       * lwlib-utils.c (XtApplyToWidgets): Ditto.
+       * lwlib.c (safe_free_str, free_widget_value, free_widget_value_tree)
+       (free_widget_info, free_widget_instance, name_to_widget): Ditto.
+       * xlwmenu.c (openXftFont): Ditto.
+
 2011-06-27  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
        * Makefile.in (ALL_CFLAGS): Add -I../lib for generated header files
index 9c9a007bc15d768efc6af4c79ce10e1daad32f51..0eea0aba7b6e3d7e9b8a91ae8a8af13130b1ce55 100644 (file)
@@ -136,7 +136,7 @@ openFont (Widget widget, char *name)
     }
 
   fn = XftFontOpenName (XtDisplay (widget), screen, fname);
-  if (fname != name) free (fname);
+  if (fname != name) xfree (fname);
 
   return fn;
 }
@@ -384,7 +384,7 @@ xaw_destroy_instance (widget_instance *instance)
       if (instance->xft_data[0].xft_font)
         XftFontClose (XtDisplay (instance->widget),
                       instance->xft_data[0].xft_font);
-      free (instance->xft_data);
+      xfree (instance->xft_data);
     }
 #endif
   if (XtIsSubclass (instance->widget, dialogWidgetClass))
index 2b7677a02f5d92c47ba8e0eb81a3cb09f8c55319..058e2e779c7adf2167bc58a4a334529fda76e88b 100644 (file)
@@ -186,9 +186,9 @@ make_destroyed_instance (char* name,
 static void
 free_destroyed_instance (destroyed_instance* instance)
 {
-  free (instance->name);
-  free (instance->type);
-  free (instance);
+  xfree (instance->name);
+  xfree (instance->type);
+  xfree (instance);
 }
 
 \f/* motif utility functions */
@@ -928,13 +928,13 @@ xm_update_one_value (widget_instance* instance,
     }
   else if (class == xmTextWidgetClass)
     {
-      free (val->value);
+      xfree (val->value);
       val->value = XmTextGetString (widget);
       val->edited = True;
     }
   else if (class == xmTextFieldWidgetClass)
     {
-      free (val->value);
+      xfree (val->value);
       val->value = XmTextFieldGetString (widget);
       val->edited = True;
     }
@@ -959,7 +959,7 @@ xm_update_one_value (widget_instance* instance,
              XtVaGetValues (toggle, XmNset, &set, NULL);
              if (set)
                {
-                 free (val->value);
+                 xfree (val->value);
                  val->value = safe_strdup (XtName (toggle));
                }
            }
index 7a0dd1b264a178cc912231b2fac2e2168b595765..fe236a210f32fb3ccaf5cb3e1131739b5910a245 100644 (file)
@@ -80,7 +80,7 @@ XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
            XtApplyToWidgets (kids [i], proc, arg);
            proc (kids [i], arg);
          }
-      free (kids);
+      xfree (kids);
     }
 }
 
index 9d8ec3330d34c4409f49704166bee47bde552c04..7e3538aec046980cdc7ed311b2d20165bb505693 100644 (file)
@@ -138,7 +138,7 @@ my_strcasecmp (const char *s1, const char *s2)
 static void
 safe_free_str (char *s)
 {
-  free (s);
+  xfree (s);
 }
 
 static widget_value *widget_value_free_list = 0;
@@ -176,7 +176,7 @@ free_widget_value (widget_value *wv)
     {
       /* When the number of already allocated cells is too big,
         We free it.  */
-      free (wv);
+      xfree (wv);
       malloc_cpt--;
     }
   else
@@ -192,9 +192,9 @@ free_widget_value_tree (widget_value *wv)
   if (!wv)
     return;
 
-  free (wv->name);
-  free (wv->value);
-  free (wv->key);
+  xfree (wv->name);
+  xfree (wv->value);
+  xfree (wv->key);
 
   wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
 
@@ -281,7 +281,7 @@ free_widget_info (widget_info *info)
   safe_free_str (info->name);
   free_widget_value_tree (info->val);
   memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
-  free (info);
+  xfree (info);
 }
 
 static void
@@ -317,7 +317,7 @@ static void
 free_widget_instance (widget_instance *instance)
 {
   memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
-  free (instance);
+  xfree (instance);
 }
 
 static widget_info *
@@ -602,7 +602,7 @@ name_to_widget (widget_instance *instance, const char *name)
 
       widget = XtNameToWidget (instance->widget, real_name);
 
-      free (real_name);
+      xfree (real_name);
     }
   return widget;
 }
index e9ec604ae7f124524069bec70bbfebc8c33014e2..5ed33d5be05a15cf3e9533d7aabeb2e3f2af2e32 100644 (file)
@@ -1891,7 +1891,7 @@ openXftFont (XlwMenuWidget mw)
         }
     }
 
-  if (fname != mw->menu.fontName) free (fname);
+  if (fname != mw->menu.fontName) xfree (fname);
 
   return mw->menu.xft_font != 0;
 }
index e22eab5f072216328da64eaf978a8a1fceaa4599..723556414f40a48f5309abedeff0951da8a1a3db 100644 (file)
        rather than rolling our own approximation.
        (SCROLL_BAR_VEC_SIZE): Remove; not used.
 
+2011-10-13  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * editfns.c (Fset_time_zone_rule): Replace free with xfree to
+       avoid crash when xmalloc overrun checking is enabled.
+
+2011-10-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (Fcurrent_bidi_paragraph_direction): Initialize
+       itb.paragraph_dir to NEUTRAL_DIR.  Fixes an occasional incorrect
+       cursor motion with <left> and <right> arrow keys.
+
+       * bidi.c (bidi_init_it): Don't initialize paragraph_dir here, as
+       some callers set that themselves.
+
 2011-10-12  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (find_row_edges): Handle the case where ROW comes from a
index e4965ed59ac8ce1c48b76ff784faadba1b46b410..c6d7db96576d06b155b82c435cee8e6f241277af 100644 (file)
@@ -808,7 +808,6 @@ bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, int frame_window_p,
   bidi_it->nchars = -1;        /* to be computed in bidi_resolve_explicit_1 */
   bidi_it->first_elt = 1;
   bidi_set_paragraph_end (bidi_it);
-  bidi_it->paragraph_dir = NEUTRAL_DIR;
   bidi_it->new_paragraph = 1;
   bidi_it->separator_limit = -1;
   bidi_it->type = NEUTRAL_B;
index 8489a47649e1ddaced96bbb0e47006f772c40e46..48b601860ca100042b9a2de3cf3cfc517a88b9a1 100644 (file)
@@ -2069,7 +2069,7 @@ only the former.  */)
     }
 
   set_time_zone_rule (tzstring);
-  free (environbuf);
+  xfree (environbuf);
   environbuf = environ;
 
   return Qnil;
index e9e8f8f420624ecdcf0997a5929b8106960069de..a264da3892a98b3160fc8552f87f9446392507c2 100644 (file)
@@ -19491,6 +19491,7 @@ See also `bidi-paragraph-direction'.  */)
            bytepos--;
        }
       bidi_init_it (pos, bytepos, FRAME_WINDOW_P (SELECTED_FRAME ()), &itb);
+      itb.paragraph_dir = NEUTRAL_DIR;
       itb.string.s = NULL;
       itb.string.lstring = Qnil;
       itb.string.bufpos = 0;