emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108793: * src/editfns.c (region_limi


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108793: * src/editfns.c (region_limit): Clip to narrowing.
Date: Thu, 28 Jun 2012 15:09:41 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108793
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11770
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2012-06-28 15:09:41 -0400
message:
  * src/editfns.c (region_limit): Clip to narrowing.
modified:
  src/ChangeLog
  src/alloc.c
  src/editfns.c
  src/keyboard.c
  src/w32fns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-28 15:50:11 +0000
+++ b/src/ChangeLog     2012-06-28 19:09:41 +0000
@@ -1,3 +1,7 @@
+2012-06-28  Stefan Monnier  <address@hidden>
+
+       * editfns.c (region_limit): Clip to narrowing (bug#11770).
+
 2012-06-28  Paul Eggert  <address@hidden>
 
        Avoid integer overflow on scroll-left and scroll-right.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-06-28 07:50:27 +0000
+++ b/src/alloc.c       2012-06-28 19:09:41 +0000
@@ -5384,7 +5384,8 @@
           turned off in that buffer.  Calling truncate_undo_list on
           Qt tends to return NULL, which effectively turns undo back on.
           So don't call truncate_undo_list if undo_list is Qt.  */
-       if (! NILP (nextb->BUFFER_INTERNAL_FIELD (name)) && ! EQ 
(nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
+       if (! NILP (nextb->BUFFER_INTERNAL_FIELD (name))
+           && ! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
          truncate_undo_list (nextb);
 
        /* Shrink buffer gaps, but skip indirect and dead buffers.  */

=== modified file 'src/editfns.c'
--- a/src/editfns.c     2012-06-22 21:17:42 +0000
+++ b/src/editfns.c     2012-06-28 19:09:41 +0000
@@ -283,8 +283,12 @@
     error ("The mark is not set now, so there is no region");
 
   if ((PT < XFASTINT (m)) == (beginningp != 0))
-    m = make_number (PT);
-  return m;
+    return make_number (PT);
+  else
+    { /* Clip to the current narrowing (bug#11770).  */
+      ptrdiff_t mark = XFASTINT (m);
+      return make_number (mark < BEGV ? BEGV : mark > ZV ? ZV : m);
+    }
 }
 
 DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0,

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2012-06-28 07:50:27 +0000
+++ b/src/keyboard.c    2012-06-28 19:09:41 +0000
@@ -3854,7 +3854,7 @@
          EMACS_TIME duration;
          EMACS_GET_TIME (duration);
          if (EMACS_TIME_GE (duration, *end_time))
-           return Qnil;        /* finished waiting */
+           return Qnil;        /* Finished waiting.  */
          else
            {
              EMACS_SUB_TIME (duration, *end_time, duration);
@@ -7309,8 +7309,8 @@
   for (p = user_signals; p; p = p->next)
     if (p->sig == sig)
       {
-        if (special_event_name &&
-            strcmp (special_event_name, p->name) == 0)
+        if (special_event_name
+           && strcmp (special_event_name, p->name) == 0)
           {
             /* Enter the debugger in many ways.  */
             debug_on_next_call = 1;

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2012-06-28 07:50:50 +0000
+++ b/src/w32fns.c      2012-06-28 19:09:41 +0000
@@ -2509,19 +2509,19 @@
      woken up if blocked in sys_select, but we do NOT want to post
      the quit_char message itself (because it will usually be as if
      the user had typed quit_char twice).  Instead, we post a dummy
-     message that has no particular effect. */
+     message that has no particular effect.  */
   {
     int c = wParam;
     if (isalpha (c) && wmsg.dwModifiers == ctrl_modifier)
       c = make_ctrl_char (c) & 0377;
     if (c == quit_char
-       || (wmsg.dwModifiers == 0 &&
-           w32_quit_key && wParam == w32_quit_key))
+       || (wmsg.dwModifiers == 0
+           && w32_quit_key && wParam == w32_quit_key))
       {
        Vquit_flag = Qt;
 
        /* The choice of message is somewhat arbitrary, as long as
-          the main thread handler just ignores it. */
+          the main thread handler just ignores it.  */
        msg = WM_NULL;
 
        /* Interrupt any blocking system calls.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]