Subject: Re: bug#11770: 24.1.50; Unable to mouse-mark regions in the info reader

From: David Kastrup <[email-masked]>
Date: Thu, 28 Jun 2012 21:41:04 +0200

Stefan Monnier <[email-masked]> writes:

>>> When marking stuff in an info file via double click, I often get a
>>> backtrace like the following:
>>> 
>>> Debugger entered--Lisp error: (args-out-of-range 1 262195)
>>> buffer-substring-no-properties(1 262195)
>>> pop-mark()
>>> mouse-drag-track((down-mouse-1 (#<window 3 on *info*> 262195 (10
>>> . 308) 26997248 nil 262195 (1 . 14) nil (3 . 6) (7 . 15))) t)
>>> mouse-drag-region((down-mouse-1 (#<window 3 on *info*> 262195 (10
>>> . 308) 26997248 nil 262195 (1 . 14) nil (3 . 6) (7 . 15))))
>>> call-interactively(mouse-drag-region nil nil)
>>> 
>>> 
>>> It does not seem to happen at the beginning of the info file, but is
>>> rather common at the end of large info files (like in "(emacs) Bugs").
>>> 
>
>> I remember reporting something similar in
>
>> http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00399.html
>
> I installed the patch below which should fix this problem.
>
>
>         Stefan
>
>
> --- src/editfns.c	2012-06-22 21:17:42 +0000
> +++ src/editfns.c	2012-06-28 19:07:10 +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,

I am somewhat skeptical that this is the right fix: the problem occured
whenever trying to mark some region for copying.  There is no good
reason this should venture outside of a narrowed region, so the fix,
while avoiding to trigger an error, is likely to leave the wrong region
marked.

Anyway, I'll check soonish.

-- 
David Kastrup